Git Unmerged
A Python command-line tool to analyze git branches and find commits that haven't been merged into a base branch.
Features
- Find all branches with recent commits (configurable time window)
- Identify branches not yet merged into a base branch (e.g.,
dev,main) - Filter branches by ignore patterns
- Configurable base branch, time window, and ignore patterns
- Clean, tabular output showing unmerged commit counts
Installation
From source
cd /c/tmp/git-unmerged
pip install .
Development installation
cd /c/tmp/git-unmerged
pip install -e .
Usage
Basic usage (analyze current directory)
git-unmerged
Analyze a specific repository
git-unmerged --repo /path/to/repo
Compare against a different base branch
git-unmerged --base-branch origin/main
Change the ignore pattern
# Ignore branches containing 'hotfix'
git-unmerged --ignore-pattern hotfix
# Don't ignore any branches
git-unmerged --ignore-pattern ""
Look back a different number of days
# Look back 90 days instead of the default 60
git-unmerged --days 90
Skip fetching from remote
git-unmerged --no-fetch
Combined example
git-unmerged \
--repo /path/to/eld-system-mobile \
--base-branch origin/dev \
--ignore-pattern "-eld" \
--days 60
Command-line Options
| Option | Default | Description |
|---|---|---|
--repo |
. (current directory) |
Path to the git repository |
--base-branch |
origin/dev |
Base branch to compare against |
--ignore-pattern |
-eld |
Pattern to ignore in branch names (use "" to disable) |
--days |
60 |
Number of days to look back for recent commits |
--no-fetch |
False |
Skip fetching from remote |
--version |
- | Show version and exit |
--help |
- | Show help message and exit |
Output Example
Fetching latest changes from remote...
Finding branches with commits in the last 60 days...
Ignoring branches containing: '-eld'
Found 22 branches NOT merged into origin/dev:
Branch Name Commits Last Commit Date
----------------------------------------------------------------------------------------------------
feat/timing-compliance 15 2025-11-21 23:25:02 +0500
feature/set_event_to_doc_activity 1 2025-11-21 21:49:45 +0500
hotfix/improve-split-sleep 2 2025-11-21 20:27:51 +0500
...
Total unmerged branches: 22
Use as a Python Module
You can also use the analyzer programmatically:
from git_unmerged.analyzer import GitUnmerged
analyzer = GitUnmerged(
repo_path='/path/to/repo',
base_branch='origin/dev',
ignore_pattern='-eld',
days=60
)
unmerged_branches = analyzer.analyze(fetch=True)
for branch in unmerged_branches:
print(f"{branch['name']}: {branch['unmerged_commits']} commits")
Requirements
- Python 3.7 or higher
- Git installed and available in PATH
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for git-unmerged 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_unmerged-1.0.0.tar.gz | 9.1 kB | Without provenance | Details for git_unmerged-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_unmerged-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for git_unmerged-1.0.0-py3-none-any.whl |
Total release size: 16.3 kB
Release files / git_unmerged-1.0.0.tar.gz
| Download URL | git_unmerged-1.0.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8efced72396c769fd15a146f0381a66da0740f923e8a902268108b65c8daf94c
|
|
BLAKE2b-256 checksum How to use checksums |
c500572c0845e8ac7e3a135b4dc589b837f75fc7b78770946fa976354d57c432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / git_unmerged-1.0.0-py3-none-any.whl
| Download URL | git_unmerged-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
777079d110977ccfff21970a3de68761eb494a354c99796b0504c0732d030975
|
|
BLAKE2b-256 checksum How to use checksums |
db93751e59dc7a75c3363a8017a11e93918417d10746cd32e3f7de0aa0667258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for git-unmerged 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.