Manage multiple git sub-repos without constantly cd-ing into their folder first.
Requires Python 3.12+.
pip install --upgrade gix-cli
gix --install-completionCheck your installed version:
gix --versionRun this once in the parent directory that holds your sub-repos:
gix initThis creates a gix.toml file in the current folder, which is where all
your registered aliases will be stored.
If you already have git repos sitting in subfolders and want to register them all at once:
gix init --fetchTo wipe an existing gix.toml and start over:
gix init --overwriteAdd the repo in your current working directory as an alias:
cd path/to/some-repo
gix alias add backendList all registered aliases:
gix alias listRename an alias:
gix alias rename backend apiRemove an alias (this only removes it from gix.toml, the repo itself
is untouched):
gix alias delete apiOnce a repo is registered under an alias, run any git command against it from anywhere inside the parent tree:
gix backend status
gix backend pull
gix backend log -5gix looks up the alias, finds the matching repo path, and runs git <your arguments> there
result = subprocess.run(["git", *git_args], cwd=engine.read()["repos"].get(alias))gixdoesn't do anything to your actual git repos. Tt only manages the alias-to-path mapping.- If
gix.tomlgets deleted or corrupted, just rungix initagain.
gix exposes its own commands as well as aliases where appropriate via
gix --install-completion
Make sure your terminal is compatible with autocompletion that goes beyond file system references.
Where it get's more complicated is with exposing native git autocompletion through gix, to stay branch-aware for example.
The native git-completion.bash is over 4000 lines long and doesn't expose the completion for external use.
After long debates the decision was made to emulate a native terminal running git in the working directory, simulating a [TAB] press and exposing the result through gix.
This comes with performance and latency problems but at least in bashed based environments it's practical and feasible.
The absolute pain of 1970s development decisions when it comes to terminals is thankfully handled by pexpect and the windows equivalent winpty.
- Verify git autocompletion works on your machine:
- Windows: PowerShell with posh-git installed.
- Linux/macOS: Bash with bash-completion and Git completion enabled.
- This step is unique to your system, we expect you to already have this setup.
- Try it out
gix backend checko<TAB>should be replaced togix backend checkout- This process might be very slow on Windows because PowerShell starup time and dialogue can sometimes take over 1 second.
Currently looking for alternatives to this / caching while still staying aware to git branches