{"id":18830760,"url":"https://github.com/madnh/subgit","last_synced_at":"2026-04-27T08:32:00.474Z","repository":{"id":206942105,"uuid":"718022025","full_name":"madnh/subgit","owner":"madnh","description":"A shell script that manages a git repository within a git repository (not a git submodule)","archived":false,"fork":false,"pushed_at":"2023-11-13T09:24:25.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T17:43:10.899Z","etag":null,"topics":["git","subgit","submodule"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madnh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-13T07:55:01.000Z","updated_at":"2023-11-13T09:16:36.000Z","dependencies_parsed_at":"2023-11-13T10:27:10.691Z","dependency_job_id":"b7aa1d1d-36f5-43d9-a6bd-ad606b67e648","html_url":"https://github.com/madnh/subgit","commit_stats":null,"previous_names":["madnh/subgit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/madnh/subgit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madnh%2Fsubgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madnh%2Fsubgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madnh%2Fsubgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madnh%2Fsubgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madnh","download_url":"https://codeload.github.com/madnh/subgit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madnh%2Fsubgit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32329463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","subgit","submodule"],"created_at":"2024-11-08T01:50:28.271Z","updated_at":"2026-04-27T08:32:00.447Z","avatar_url":"https://github.com/madnh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# subgit\n\nYou have a git repository, and the files are ignored. But maybe those ignored files are really important, and you want to manage them with git?\n\n**subgit** is a tool that helps you manage git repositories within a git repository. Not a submodule of git but a separate git repo that exists inside the current git repo. Completely separate, only sharing working directory.\n\nLet's say your repo is like this:\n\n```\nproject-x/\n├── index.js\n├── .env             \u003c--- git ignored\n└── .gitignore\n```\n\nUsing **subgit**, you will create a bare git repo named `subgit` in the `.git` folder. You can use this repo to do anything, such as managing ignored files (`.env`, `docs/`, `.dev/`,...).\n\n```\nproject-x/\n├── .git/\n│   └── subgit/\n├── index.js\n├── .env\n└── .gitignore\n```\n\n`.env` file ignored by `.gitignore` in current git repo, but tracking by `.git/subgit` repo.\n\n## Install\n\nJust download [**subgit**](https://raw.githubusercontent.com/madnh/subgit/master/subgit) file, then put somewhere you can access in terminal.\n\nExample: store in `$HOME/bin/` folder\n\n```sh\nwget https://raw.githubusercontent.com/madnh/subgit/master/subgit -O $HOME/bin/subgit\n\nchmod +x $HOME/bin/subgit\n```\n\n## Usage\n\n```\nsubgit [command]\n\nAvaiable commands:\n  init              Initialize a subgit repo\n\n  list              List all subgit repos. Alias: `ls`\n\n  remove            Remove a subgit repo, before remove will show confirm, type 'yes' to remove. Alias: `rm`\n\n  shell             Enter subshell of subgit, this subshell already define GIT_DIR and GIT_WORK_TREE.\n                    You can run commands like `git status`, `git commit`, `lazygit`,.. etc.\n\n  lazygit           run lazygit on subgit. This is a shortcut for `subgit shell` then run `lazygit`. Alias: `lazy`\n\n  [git command]     Other commands of git, like: status, branch, checkout, reset, push,... etc\n```\n\n## Environment variables\n\n| Name                 | Desc                                                                                                     |\n| -------------------- | -------------------------------------------------------------------------------------------------------- |\n| `SUBGIT`             | Name of subgit folder. If specified then target folder will be \".git/subgit-$SUBGIT\", else \".git/subgit\" |\n| `IS_SUBGIT_SUBSHELL` | **subgit** use this env to indicated that current shell is in a subgit repo                              |\n\n## Examples\n\n### Create a subgit repo\n\n```sh\nsubgit init\n```\n\n### Create a subgit repo with custom name\n\n```sh\nSUBGIT=foo subgit init\n```\n\n### List current subgit repos\n\n```sh\nsubgit list\n\n# or:\nsubgit ls\n```\n\n### Remove a subgit repo\n\n#### Remove default repo\n\n```sh\nsubgit remove\n```\n\n#### Remove custom repo\n\n```sh\nSUBGIT=foo subgit remove\n```\n\n### Open a subgit repo with Lazygit\n\n```sh\nsubgit lazygit\n\n# or\nsubgit lazy\n\n# or\nSUBGIT=foo subgit lazy\n```\n\n### Open a subshell in context of subgit repo\n\n```sh\nsubgit shell\n\n# or\nSUBGIT=foo subgit shell\n```\n\n### Run git commands\n\n```sh\nsubgit status\nsubgit add [file]\nsubgit add [file] --force\nsubgit commit\nsubgit push\n\n# or\nSUBGIT=foo git add status\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadnh%2Fsubgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadnh%2Fsubgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadnh%2Fsubgit/lists"}