Skip to main content

git-substatus

CI status Python version PyPI version hub.docker.com pre-commit Code style: black

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

  • worktree

Usage

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.

Installation

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.

Development

This tool has no module dependency outside The Python Standard Library.

Development docs

Versioning and release

  1. Bump up the __version__ in git_substatus/__init__.py and commit the change in the batch where you changed the files.

  2. (For the codeowners) This step is only on master. Create a version tag with make tag-create target. Push the tag to the origin with make 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.

pre-commit

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:

Add tests

  • Write/update unit tests (if relevant). You can start by adding/modifying a case to generator file of scripts/generate_test_repos.sh.

Run tests && debugging

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

Add new methods

Metadata

Release files for git-substatus 0.2.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-substatus 0.2.11
File Size Uploaded
git-substatus-0.2.11.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-substatus 0.2.11
File Interpreter ABI Platform
git_substatus-0.2.11-py3-none-any.whl Python 3 none any Details

Total release size: 50.1 kB

Release files / git-substatus-0.2.11.tar.gz

Download URL git-substatus-0.2.11.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
439771f0e8e2711bf3bee1526aa3438b5e92ea86cc0995ed9b50fd9c48b3c2e8
BLAKE2b-256 checksum
How to use checksums
eaad5fae6dee94422a7cfb1ae90943c09c4bcb7168d7ac0132c10ca03a002199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / git_substatus-0.2.11-py3-none-any.whl

Download URL git_substatus-0.2.11-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04bb69ad19bd6b1cef436624256ac3236b7ee15e1c1e241362573dcf0d455650
BLAKE2b-256 checksum
How to use checksums
f462aa2e2508241c80cb33dd7bab630bc82b42cf3460ebc01c88993cd6988728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.2.11 This release

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page