git-multi-status 0.0.1__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_multi_status-0.2.0/.github/dependabot.yml +22 -0
- git_multi_status-0.2.0/.github/workflows/ci.yml +70 -0
- git_multi_status-0.2.0/.github/workflows/publish.yml +36 -0
- git_multi_status-0.2.0/.gitignore +17 -0
- git_multi_status-0.2.0/.python-version +1 -0
- git_multi_status-0.2.0/Justfile +36 -0
- git_multi_status-0.2.0/LICENSE +25 -0
- git_multi_status-0.2.0/PKG-INFO +196 -0
- git_multi_status-0.2.0/README.md +170 -0
- git_multi_status-0.2.0/pyproject.toml +66 -0
- git_multi_status-0.2.0/src/git_multi_status/__init__.py +10 -0
- git_multi_status-0.2.0/src/git_multi_status/__main__.py +118 -0
- git_multi_status-0.2.0/src/git_multi_status/config.py +71 -0
- git_multi_status-0.2.0/src/git_multi_status/console.py +10 -0
- git_multi_status-0.2.0/src/git_multi_status/display.py +153 -0
- git_multi_status-0.2.0/src/git_multi_status/git_utils.py +349 -0
- git_multi_status-0.2.0/src/git_multi_status/repo_finder.py +92 -0
- git_multi_status-0.2.0/src/git_multi_status/status_checker.py +109 -0
- git_multi_status-0.2.0/tests/__init__.py +1 -0
- git_multi_status-0.2.0/tests/conftest.py +129 -0
- git_multi_status-0.2.0/tests/helpers.py +39 -0
- git_multi_status-0.2.0/tests/test_config.py +124 -0
- git_multi_status-0.2.0/tests/test_display.py +343 -0
- git_multi_status-0.2.0/tests/test_git_utils.py +391 -0
- git_multi_status-0.2.0/tests/test_main.py +318 -0
- git_multi_status-0.2.0/tests/test_repo_finder.py +166 -0
- git_multi_status-0.2.0/tests/test_status_checker.py +298 -0
- git_multi_status-0.2.0/uv.lock +333 -0
- git_multi_status-0.0.1/PKG-INFO +0 -12
- git_multi_status-0.0.1/README.md +0 -3
- git_multi_status-0.0.1/pyproject.toml +0 -28
- git_multi_status-0.0.1/setup.cfg +0 -4
- git_multi_status-0.0.1/src/git_multi_status/__main__.py +0 -410
- git_multi_status-0.0.1/src/git_multi_status.egg-info/PKG-INFO +0 -12
- git_multi_status-0.0.1/src/git_multi_status.egg-info/SOURCES.txt +0 -9
- git_multi_status-0.0.1/src/git_multi_status.egg-info/dependency_links.txt +0 -1
- git_multi_status-0.0.1/src/git_multi_status.egg-info/entry_points.txt +0 -2
- git_multi_status-0.0.1/src/git_multi_status.egg-info/requires.txt +0 -2
- git_multi_status-0.0.1/src/git_multi_status.egg-info/top_level.txt +0 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Dependabot version updates
|
|
2
|
+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
# Python dependencies are locked in uv.lock, which the "pip" ecosystem does not update
|
|
7
|
+
- package-ecosystem: "uv"
|
|
8
|
+
directory: "/"
|
|
9
|
+
schedule:
|
|
10
|
+
interval: "weekly"
|
|
11
|
+
groups:
|
|
12
|
+
python-dependencies:
|
|
13
|
+
patterns: ["*"]
|
|
14
|
+
|
|
15
|
+
# Keep the actions used by the workflows current
|
|
16
|
+
- package-ecosystem: "github-actions"
|
|
17
|
+
directory: "/"
|
|
18
|
+
schedule:
|
|
19
|
+
interval: "weekly"
|
|
20
|
+
groups:
|
|
21
|
+
github-actions:
|
|
22
|
+
patterns: ["*"]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
# Lets the publish workflow run exactly the same checks before a release
|
|
9
|
+
workflow_call:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
lint:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --locked
|
|
29
|
+
|
|
30
|
+
- name: Run linting with ruff
|
|
31
|
+
run: |
|
|
32
|
+
uv run ruff check .
|
|
33
|
+
uv run ruff format --check .
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v7
|
|
44
|
+
|
|
45
|
+
# python-version sets UV_PYTHON, which takes precedence over .python-version
|
|
46
|
+
- name: Install uv and Python ${{ matrix.python-version }}
|
|
47
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
48
|
+
with:
|
|
49
|
+
python-version: ${{ matrix.python-version }}
|
|
50
|
+
|
|
51
|
+
- name: Install dependencies
|
|
52
|
+
run: uv sync --locked
|
|
53
|
+
|
|
54
|
+
- name: Run tests
|
|
55
|
+
run: uv run pytest -v --cov=git_multi_status --cov-report=term
|
|
56
|
+
|
|
57
|
+
- name: Test CLI installation and basic functionality
|
|
58
|
+
run: |
|
|
59
|
+
uv run python --version
|
|
60
|
+
uv run git-multi-status --help
|
|
61
|
+
uv run git-multi-status -h
|
|
62
|
+
uv run git-multi-status --version
|
|
63
|
+
|
|
64
|
+
# Scan a repository whose state we control, so the exact output and a
|
|
65
|
+
# zero exit code can be required rather than tolerating any failure.
|
|
66
|
+
scratch="$(mktemp -d)"
|
|
67
|
+
git init --quiet "$scratch/repo"
|
|
68
|
+
uv run git-multi-status "$scratch" | tee output.txt
|
|
69
|
+
grep --line-regexp --fixed-strings "$scratch/repo: ok" output.txt
|
|
70
|
+
rm output.txt
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
uses: ./.github/workflows/ci.yml
|
|
13
|
+
|
|
14
|
+
deploy:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
needs: test
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
22
|
+
|
|
23
|
+
# The tag comes from the release event (passed through the environment so
|
|
24
|
+
# it is never interpolated into the script); a leading "v" is dropped.
|
|
25
|
+
- name: Set version from release tag
|
|
26
|
+
env:
|
|
27
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
28
|
+
run: uv version --frozen "${TAG#v}"
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: uv build
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
env:
|
|
35
|
+
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
|
|
36
|
+
run: uv publish
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# List the available recipes
|
|
2
|
+
default:
|
|
3
|
+
@just --list
|
|
4
|
+
|
|
5
|
+
# Install the project and its development dependencies
|
|
6
|
+
install:
|
|
7
|
+
uv sync --locked
|
|
8
|
+
|
|
9
|
+
# Run the test suite (extra arguments are passed to pytest)
|
|
10
|
+
test *args:
|
|
11
|
+
uv run pytest {{ args }}
|
|
12
|
+
|
|
13
|
+
# Run the tests with a terminal coverage report
|
|
14
|
+
coverage:
|
|
15
|
+
uv run pytest --cov=git_multi_status --cov-report=term-missing
|
|
16
|
+
|
|
17
|
+
# Check linting and formatting without changing anything
|
|
18
|
+
lint:
|
|
19
|
+
uv run ruff check .
|
|
20
|
+
uv run ruff format --check .
|
|
21
|
+
|
|
22
|
+
# Apply lint fixes and formatting
|
|
23
|
+
fmt:
|
|
24
|
+
uv run ruff check --fix .
|
|
25
|
+
uv run ruff format .
|
|
26
|
+
|
|
27
|
+
# Everything CI runs
|
|
28
|
+
check: lint test
|
|
29
|
+
|
|
30
|
+
# Run the CLI from the working tree (e.g. `just run -b ~/projects`)
|
|
31
|
+
run *args:
|
|
32
|
+
uv run git-multi-status {{ args }}
|
|
33
|
+
|
|
34
|
+
# Build the sdist and wheel
|
|
35
|
+
build:
|
|
36
|
+
uv build
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Adam McKay
|
|
4
|
+
|
|
5
|
+
git-multi-status is a Python port of multi-git-status
|
|
6
|
+
(https://github.com/fboender/multi-git-status),
|
|
7
|
+
Copyright (c) 2015-2022 Ferry Boender, also released under the MIT License.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: git-multi-status
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Show uncommitted, untracked and unpushed changes across multiple Git repositories
|
|
5
|
+
Project-URL: Repository, https://github.com/Beep-Boop-Digital/git-multi-status
|
|
6
|
+
Project-URL: Issues, https://github.com/Beep-Boop-Digital/git-multi-status/issues
|
|
7
|
+
Author: Adam McKay
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: cli,git,multi-git-status,repositories,status
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: rich>=14.0.0
|
|
24
|
+
Requires-Dist: typer>=0.15.2
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# Git Multi Status
|
|
28
|
+
|
|
29
|
+
A Python tool to list the status of multiple Git repositories in a directory. This is a Python port of the original [multi-git-status](https://github.com/fboender/multi-git-status) shell script.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- 🔍 **Repository Discovery**: Recursively scan directories for Git repositories, including linked worktrees
|
|
34
|
+
- 📊 **Comprehensive Status**: Shows uncommitted changes, untracked files, push/pull status, and stashes
|
|
35
|
+
- ⚡ **Configurable Depth**: Limit how far down the directory tree to look
|
|
36
|
+
- 🎨 **Rich Output**: Colorized terminal output, one line per repository so it stays easy to `grep`
|
|
37
|
+
- 🛠️ **Flexible Options**: Extensive filtering and display customization
|
|
38
|
+
- 🚦 **Script Friendly**: Meaningful exit codes, diagnostics on stderr
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
Install from PyPI using your preferred package manager:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Using pipx (recommended for CLI tools)
|
|
46
|
+
pipx install git-multi-status
|
|
47
|
+
|
|
48
|
+
# Using uv
|
|
49
|
+
uv tool install git-multi-status
|
|
50
|
+
# ...or run it without installing
|
|
51
|
+
uvx git-multi-status
|
|
52
|
+
|
|
53
|
+
# Using pip
|
|
54
|
+
pip install git-multi-status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Requires Python 3.10 or newer and `git` on your `PATH`.
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### Basic Usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Scan current directory
|
|
65
|
+
git-multi-status
|
|
66
|
+
# OR use as a git subcommand
|
|
67
|
+
git multi-status
|
|
68
|
+
|
|
69
|
+
# Scan specific directory
|
|
70
|
+
git-multi-status /path/to/projects
|
|
71
|
+
git multi-status /path/to/projects
|
|
72
|
+
|
|
73
|
+
# Show only repositories with changes
|
|
74
|
+
git-multi-status --no-ok
|
|
75
|
+
|
|
76
|
+
# Include branch information
|
|
77
|
+
git-multi-status -b
|
|
78
|
+
|
|
79
|
+
# Fetch latest changes (slower but more accurate)
|
|
80
|
+
git-multi-status -f
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> **Note**: Since the tool is named `git-multi-status`, it can be executed as either `git-multi-status` or as a Git subcommand `git multi-status`. Git handles `--help` itself for subcommands (it looks for a man page), so use `git multi-status -h` to see the help in that form.
|
|
84
|
+
|
|
85
|
+
### Output Example
|
|
86
|
+
|
|
87
|
+
Each repository is printed on one line, with every status that applies:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
$ git-multi-status ~/projects
|
|
91
|
+
/home/me/projects/api: Needs push (main) Uncommitted changes
|
|
92
|
+
/home/me/projects/docs: ok
|
|
93
|
+
/home/me/projects/website: Needs upstream (feature/login) Untracked files 2 stashes
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
With branch information (`-b`):
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
/home/me/projects/api (main): Needs push (main) Uncommitted changes
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
One status per line (`--flatten`), which is convenient for `grep` and `sort`:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
/home/me/projects/api: Needs push (main)
|
|
106
|
+
/home/me/projects/api: Uncommitted changes
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| Status | Meaning |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| `ok` | Nothing to report |
|
|
112
|
+
| `Needs push (branches)` | The branches have commits their upstream does not |
|
|
113
|
+
| `Needs pull (branches)` | The upstream has commits the branches do not (run with `-f` to check against the remote's current state) |
|
|
114
|
+
| `Needs upstream (branches)` | The branches have no upstream, or it has been deleted. Only reported when the repository has a remote |
|
|
115
|
+
| `Uncommitted changes` | Staged or unstaged changes to tracked files |
|
|
116
|
+
| `Untracked files` | Files that are neither tracked nor ignored |
|
|
117
|
+
| `N stashes` | Entries in the stash |
|
|
118
|
+
| `Locked. Skipping.` | An `index.lock` exists, so another git process is (or was) running |
|
|
119
|
+
| `Unsafe ownership, owned by someone else. Skipping.` | The repository belongs to a different user |
|
|
120
|
+
| `Error: ...` | Git could not read the repository, for example because it is corrupted |
|
|
121
|
+
|
|
122
|
+
### Exit Codes
|
|
123
|
+
|
|
124
|
+
| Code | Meaning |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| `0` | Every repository is ok |
|
|
127
|
+
| `1` | At least one repository needs attention, is locked, unsafe, or could not be read |
|
|
128
|
+
| `2` | Usage error, such as a directory that does not exist |
|
|
129
|
+
|
|
130
|
+
The `--no-*` filters apply to the exit code as well as the output: with `--no-stashes`, a repository whose only finding is a stash counts as ok.
|
|
131
|
+
|
|
132
|
+
A failed `git fetch` (`-f`) prints a warning on stderr. The repository's status is still reported from what is available locally, and the exit code is not affected.
|
|
133
|
+
|
|
134
|
+
### Command Reference
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
Usage: git-multi-status [OPTIONS] [DIR]
|
|
138
|
+
|
|
139
|
+
git-multi-status shows uncommitted, untracked and unpushed changes in multiple Git repositories.
|
|
140
|
+
|
|
141
|
+
Arguments:
|
|
142
|
+
[DIR] Dir to scan [default: .]
|
|
143
|
+
|
|
144
|
+
Options:
|
|
145
|
+
-w Warn about dirs that are not Git repositories
|
|
146
|
+
-e, --no-ok Exclude repos that are 'ok'
|
|
147
|
+
-f Do a 'git fetch' on each repo (slow for many repos)
|
|
148
|
+
--throttle SEC Wait SEC seconds between each 'git fetch' (-f option) [default: 0]
|
|
149
|
+
-d, --depth INTEGER Scan depth: 0=no recursion, -1=unlimited, >0=max depth [default: 2]
|
|
150
|
+
--flatten Show only one status per line
|
|
151
|
+
-b Show currently checked out branch
|
|
152
|
+
--no-push Limit output: hide push status
|
|
153
|
+
--no-pull Limit output: hide pull status
|
|
154
|
+
--no-upstream Limit output: hide upstream status
|
|
155
|
+
--no-uncommitted Limit output: hide uncommitted changes
|
|
156
|
+
--no-untracked Limit output: hide untracked files
|
|
157
|
+
--no-stashes Limit output: hide stashes
|
|
158
|
+
-v, --version Show version and exit
|
|
159
|
+
--debug Enable debug output (written to stderr)
|
|
160
|
+
-h, --help Show this message and exit
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Ignoring a Repository
|
|
164
|
+
|
|
165
|
+
To leave a repository out of the report, set this in that repository (the same setting the original `mgitstatus` uses):
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git config --local mgitstatus.ignore true
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### What Counts as a Repository
|
|
172
|
+
|
|
173
|
+
A directory is treated as a repository if it contains a `.git` directory, or a `.git` file pointing at one, which is how linked worktrees (`git worktree add`) and submodule checkouts are set up. The scan does not descend into a repository once it has found one, so submodules nested inside a repository are not listed separately; changes inside them show up as `Uncommitted changes` on the parent.
|
|
174
|
+
|
|
175
|
+
Symbolic links are followed. A repository reachable through more than one path is listed once.
|
|
176
|
+
|
|
177
|
+
### Security
|
|
178
|
+
|
|
179
|
+
`git-multi-status` runs `git` inside every repository it finds, and git reads that repository's own configuration. The tool disables `core.fsmonitor` (which can name an arbitrary command), stops git from prompting for credentials, and skips repositories owned by another user. Other settings a repository can carry, such as clean/smudge filters, or the remote helpers and SSH commands used when fetching with `-f`, are still honoured by git, so treat scanning a directory of repositories you do not trust the same way you would treat running `git status` in each of them.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
The project uses [uv](https://docs.astral.sh/uv/) and, optionally, [just](https://just.systems/) as a task runner:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
just install # uv sync --locked
|
|
187
|
+
just test # uv run pytest
|
|
188
|
+
just lint # ruff check + ruff format --check
|
|
189
|
+
just fmt # apply lint fixes and formatting
|
|
190
|
+
just check # lint and test, as CI does
|
|
191
|
+
just run -b ~/projects
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT. See [LICENSE](LICENSE). Based on [multi-git-status](https://github.com/fboender/multi-git-status) by Ferry Boender.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Git Multi Status
|
|
2
|
+
|
|
3
|
+
A Python tool to list the status of multiple Git repositories in a directory. This is a Python port of the original [multi-git-status](https://github.com/fboender/multi-git-status) shell script.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔍 **Repository Discovery**: Recursively scan directories for Git repositories, including linked worktrees
|
|
8
|
+
- 📊 **Comprehensive Status**: Shows uncommitted changes, untracked files, push/pull status, and stashes
|
|
9
|
+
- ⚡ **Configurable Depth**: Limit how far down the directory tree to look
|
|
10
|
+
- 🎨 **Rich Output**: Colorized terminal output, one line per repository so it stays easy to `grep`
|
|
11
|
+
- 🛠️ **Flexible Options**: Extensive filtering and display customization
|
|
12
|
+
- 🚦 **Script Friendly**: Meaningful exit codes, diagnostics on stderr
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
Install from PyPI using your preferred package manager:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Using pipx (recommended for CLI tools)
|
|
20
|
+
pipx install git-multi-status
|
|
21
|
+
|
|
22
|
+
# Using uv
|
|
23
|
+
uv tool install git-multi-status
|
|
24
|
+
# ...or run it without installing
|
|
25
|
+
uvx git-multi-status
|
|
26
|
+
|
|
27
|
+
# Using pip
|
|
28
|
+
pip install git-multi-status
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Requires Python 3.10 or newer and `git` on your `PATH`.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Basic Usage
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Scan current directory
|
|
39
|
+
git-multi-status
|
|
40
|
+
# OR use as a git subcommand
|
|
41
|
+
git multi-status
|
|
42
|
+
|
|
43
|
+
# Scan specific directory
|
|
44
|
+
git-multi-status /path/to/projects
|
|
45
|
+
git multi-status /path/to/projects
|
|
46
|
+
|
|
47
|
+
# Show only repositories with changes
|
|
48
|
+
git-multi-status --no-ok
|
|
49
|
+
|
|
50
|
+
# Include branch information
|
|
51
|
+
git-multi-status -b
|
|
52
|
+
|
|
53
|
+
# Fetch latest changes (slower but more accurate)
|
|
54
|
+
git-multi-status -f
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Note**: Since the tool is named `git-multi-status`, it can be executed as either `git-multi-status` or as a Git subcommand `git multi-status`. Git handles `--help` itself for subcommands (it looks for a man page), so use `git multi-status -h` to see the help in that form.
|
|
58
|
+
|
|
59
|
+
### Output Example
|
|
60
|
+
|
|
61
|
+
Each repository is printed on one line, with every status that applies:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
$ git-multi-status ~/projects
|
|
65
|
+
/home/me/projects/api: Needs push (main) Uncommitted changes
|
|
66
|
+
/home/me/projects/docs: ok
|
|
67
|
+
/home/me/projects/website: Needs upstream (feature/login) Untracked files 2 stashes
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
With branch information (`-b`):
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
/home/me/projects/api (main): Needs push (main) Uncommitted changes
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
One status per line (`--flatten`), which is convenient for `grep` and `sort`:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
/home/me/projects/api: Needs push (main)
|
|
80
|
+
/home/me/projects/api: Uncommitted changes
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| Status | Meaning |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `ok` | Nothing to report |
|
|
86
|
+
| `Needs push (branches)` | The branches have commits their upstream does not |
|
|
87
|
+
| `Needs pull (branches)` | The upstream has commits the branches do not (run with `-f` to check against the remote's current state) |
|
|
88
|
+
| `Needs upstream (branches)` | The branches have no upstream, or it has been deleted. Only reported when the repository has a remote |
|
|
89
|
+
| `Uncommitted changes` | Staged or unstaged changes to tracked files |
|
|
90
|
+
| `Untracked files` | Files that are neither tracked nor ignored |
|
|
91
|
+
| `N stashes` | Entries in the stash |
|
|
92
|
+
| `Locked. Skipping.` | An `index.lock` exists, so another git process is (or was) running |
|
|
93
|
+
| `Unsafe ownership, owned by someone else. Skipping.` | The repository belongs to a different user |
|
|
94
|
+
| `Error: ...` | Git could not read the repository, for example because it is corrupted |
|
|
95
|
+
|
|
96
|
+
### Exit Codes
|
|
97
|
+
|
|
98
|
+
| Code | Meaning |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `0` | Every repository is ok |
|
|
101
|
+
| `1` | At least one repository needs attention, is locked, unsafe, or could not be read |
|
|
102
|
+
| `2` | Usage error, such as a directory that does not exist |
|
|
103
|
+
|
|
104
|
+
The `--no-*` filters apply to the exit code as well as the output: with `--no-stashes`, a repository whose only finding is a stash counts as ok.
|
|
105
|
+
|
|
106
|
+
A failed `git fetch` (`-f`) prints a warning on stderr. The repository's status is still reported from what is available locally, and the exit code is not affected.
|
|
107
|
+
|
|
108
|
+
### Command Reference
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Usage: git-multi-status [OPTIONS] [DIR]
|
|
112
|
+
|
|
113
|
+
git-multi-status shows uncommitted, untracked and unpushed changes in multiple Git repositories.
|
|
114
|
+
|
|
115
|
+
Arguments:
|
|
116
|
+
[DIR] Dir to scan [default: .]
|
|
117
|
+
|
|
118
|
+
Options:
|
|
119
|
+
-w Warn about dirs that are not Git repositories
|
|
120
|
+
-e, --no-ok Exclude repos that are 'ok'
|
|
121
|
+
-f Do a 'git fetch' on each repo (slow for many repos)
|
|
122
|
+
--throttle SEC Wait SEC seconds between each 'git fetch' (-f option) [default: 0]
|
|
123
|
+
-d, --depth INTEGER Scan depth: 0=no recursion, -1=unlimited, >0=max depth [default: 2]
|
|
124
|
+
--flatten Show only one status per line
|
|
125
|
+
-b Show currently checked out branch
|
|
126
|
+
--no-push Limit output: hide push status
|
|
127
|
+
--no-pull Limit output: hide pull status
|
|
128
|
+
--no-upstream Limit output: hide upstream status
|
|
129
|
+
--no-uncommitted Limit output: hide uncommitted changes
|
|
130
|
+
--no-untracked Limit output: hide untracked files
|
|
131
|
+
--no-stashes Limit output: hide stashes
|
|
132
|
+
-v, --version Show version and exit
|
|
133
|
+
--debug Enable debug output (written to stderr)
|
|
134
|
+
-h, --help Show this message and exit
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Ignoring a Repository
|
|
138
|
+
|
|
139
|
+
To leave a repository out of the report, set this in that repository (the same setting the original `mgitstatus` uses):
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git config --local mgitstatus.ignore true
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### What Counts as a Repository
|
|
146
|
+
|
|
147
|
+
A directory is treated as a repository if it contains a `.git` directory, or a `.git` file pointing at one, which is how linked worktrees (`git worktree add`) and submodule checkouts are set up. The scan does not descend into a repository once it has found one, so submodules nested inside a repository are not listed separately; changes inside them show up as `Uncommitted changes` on the parent.
|
|
148
|
+
|
|
149
|
+
Symbolic links are followed. A repository reachable through more than one path is listed once.
|
|
150
|
+
|
|
151
|
+
### Security
|
|
152
|
+
|
|
153
|
+
`git-multi-status` runs `git` inside every repository it finds, and git reads that repository's own configuration. The tool disables `core.fsmonitor` (which can name an arbitrary command), stops git from prompting for credentials, and skips repositories owned by another user. Other settings a repository can carry, such as clean/smudge filters, or the remote helpers and SSH commands used when fetching with `-f`, are still honoured by git, so treat scanning a directory of repositories you do not trust the same way you would treat running `git status` in each of them.
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
The project uses [uv](https://docs.astral.sh/uv/) and, optionally, [just](https://just.systems/) as a task runner:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
just install # uv sync --locked
|
|
161
|
+
just test # uv run pytest
|
|
162
|
+
just lint # ruff check + ruff format --check
|
|
163
|
+
just fmt # apply lint fixes and formatting
|
|
164
|
+
just check # lint and test, as CI does
|
|
165
|
+
just run -b ~/projects
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT. See [LICENSE](LICENSE). Based on [multi-git-status](https://github.com/fboender/multi-git-status) by Ferry Boender.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "git-multi-status"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Show uncommitted, untracked and unpushed changes across multiple Git repositories"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Adam McKay" }]
|
|
10
|
+
keywords = ["git", "status", "cli", "repositories", "multi-git-status"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Environment :: Console",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Software Development :: Version Control :: Git",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"rich>=14.0.0",
|
|
26
|
+
"typer>=0.15.2",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/Beep-Boop-Digital/git-multi-status"
|
|
31
|
+
Issues = "https://github.com/Beep-Boop-Digital/git-multi-status/issues"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
git-multi-status = "git_multi_status.__main__:app"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["hatchling>=1.27"]
|
|
38
|
+
build-backend = "hatchling.build"
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
testpaths = ["tests"]
|
|
42
|
+
|
|
43
|
+
[tool.ruff]
|
|
44
|
+
line-length = 120
|
|
45
|
+
target-version = "py310"
|
|
46
|
+
|
|
47
|
+
[tool.ruff.lint]
|
|
48
|
+
select = ["F", "E", "W", "I", "PL"]
|
|
49
|
+
ignore = ["E501", "W191", "PLR0913", "PLR0917", "PLR0912", "PLR0915"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint.isort]
|
|
52
|
+
known-first-party = ["git_multi_status"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint.pylint]
|
|
55
|
+
max-returns = 10
|
|
56
|
+
max-branches = 20
|
|
57
|
+
|
|
58
|
+
[tool.ruff.lint.per-file-ignores]
|
|
59
|
+
"tests/*" = ["PLR2004"]
|
|
60
|
+
|
|
61
|
+
[dependency-groups]
|
|
62
|
+
dev = [
|
|
63
|
+
"pytest>=8.4.0",
|
|
64
|
+
"pytest-cov>=6.1.1",
|
|
65
|
+
"ruff>=0.6.9",
|
|
66
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Git Multi Status - Check status of multiple git repositories."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version("git-multi-status")
|
|
7
|
+
except PackageNotFoundError:
|
|
8
|
+
__version__ = "dev"
|
|
9
|
+
|
|
10
|
+
__all__ = ["__version__"]
|