A command-line tool to inspect the status of git repositories from a directory, e.g., a projects folder keeping all of your git projects. You can inspect:
-
status
-
added, removed, modified, renamed
-
merge conflicts
-
etc.
-
-
stash
See at git-substatus --help
:
usage: git-substatus [-h] [-v] [--include-hidden] [--fetch] [path]
See subdirectories' git status
==============================
The output consists of four columns:
repo name | branch head | status | git stashes (if any)
The string (*WT) seen next to the repo names shows that the
repo has some git worktrees. See more:
<https://git-scm.com/docs/git-worktree>
positional arguments:
path a path to where you want to see git substatuses. If empty, the
current working directory is selected.
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--include-hidden repositories starting with a dot (.) are included.
--fetch perform git fetch from remote on all sub repositories.
Install from the PyPI:
pip install git-substatus
Install from the repo:
pip install git https://github.com/strboul/git-substatus.git
Alternatively, the Docker image can be used:
docker run --rm -t -v "$(pwd)":/"$(pwd)" -w "$(pwd)" strboul/git-substatus:latest
To shorten the command, it's also possible to add an alias in the .bashrc
or
.zshrc
, e.g.:
_git_substatus() {
docker run --rm -t -v "$(pwd)":/"$(pwd)" -w "$(pwd)" strboul/git-substatus:latest "$@"
}
alias git-substatus="_git_substatus"
Benchmark: it's measured that the container solution is ~70% slower than the native operation due to the overhead; however, the container solution is still useful for portability matters.
This tool has no module dependency outside The Python Standard Library.
Development docs
-
Bump up the
__version__
ingit_substatus/__init__.py
and commit the change in the batch where you changed the files. -
(For the codeowners) This step is only on master. Create a version tag with
make tag-create
target. Push the tag to the origin withmake tag-push
. Upon the push, the release CI workflow will be triggered that will distribute the new version to the platforms, such as PyPI, DockerHub.
Run pre-commit git hooks on every commit that run checks against the files added to a commit.
Upon cloning the repo, set up pre-commit
:
- Install pre-commit https://pre-commit.com/#installation
- Run
pre-commit install
that installs the hook scripts at.git/hooks
- Write/update unit tests (if relevant). You can start by adding/modifying a
case to generator file of
scripts/generate_test_repos.sh
.
virtualenv venv
source venv/bin/activate # deactivate
pip install -r dev-requirements.txt # pip freeze > dev-requirements.txt
make
Put a breakpoint()
at a relevant place and run:
make test
- Use the reference to name the functions/methods in the module: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitglossary.html