Zero-Footprint Git Repository Analysis Tool See into your repository's soul without checking out files!
- π Features
- π οΈ Installation
- π‘ Usage
- π Report Examples
- π§ Dependencies
- β Why Use This?
- π§ Technical Details
- π€ Contributing
- βοΈ License
β¨ Powerful Insights in Your Terminal βοΈ Two-stage filtering (include then exclude) βοΈ Full repository/subtree visualization βοΈ Concatenation safety checks (null bytes, invalid UTF-8) βοΈ Size analysis with LFS tracking βοΈ Submodule & symlink detection
β‘ Performance Optimized β Works with multi-GB repositories β No working directory required β Parallel processing where possible
π Safety First βοΈ Pure read-only operations βοΈ Strict input validation βοΈ Clean error handling
Windows Note: Requires Git Bash/WSL2 for full functionality
git clone https://github.com/da2ce7/git-subtree-report.git
cd git-subtree-report
# Local Installation (ensure that `~/.local/bin` is in your $PATH)
install -Dm755 bin/git_subtree_report.sh ~/.local/bin/git-subtree-report-1
# System Installation
sudo install -m 0755 bin/git_subtree_report.sh /usr/local/bin/git-subtree-report-1
# Install Meson (Ubuntu)
sudo apt install meson
# Install Meson (Fedora)
sudo dnf install meson
# Local Configure (ensure that `~/.local/bin` is in your $PATH)
meson setup build --prefix ~/.local
# System Configure
meson setup build
# Build
meson compile -C build
meson install -C build
meson dist -C build --formats gztar
Option | Description | Default |
---|---|---|
-C, --working-dir <DIR> |
Change to directory <DIR> before running analysis. |
. (current directory) |
-i, --include <PATTERN> |
Only include files matching an ERE (allow-list). Applied before exclude. | (none) |
-e, --exclude <PATTERN> |
Exclude files from the included set matching an ERE (block-list). | (none) |
-h, --help |
Display a detailed help message and exit. | (N/A) |
-o, --output-concat |
Enable concatenated output of all safe text files. | Disabled |
-r, --ref <REF> |
Git reference (commit, branch, tag) to analyze. | HEAD |
-s, --max-size <SIZE> |
Set max file size for content analysis (e.g., 1M , 500K ). |
1M |
-t, --subtree <PATH> |
Relative path of the subdirectory to analyze. | . (from within repo) |
--version |
Display version information and exit. | (N/A) |
The script applies filters in a two-stage process for powerful and precise file selection:
- Inclusion (
--include
): First, an "allow-list" is created. If--include
is used, only files matching the pattern are kept. If it's not used, all files in the subtree are kept. - Exclusion (
--exclude
): Next, the--exclude
pattern is run against the results of the inclusion stage. Any files from that set matching the exclusion pattern are removed.
All Files in Subtree
β [--include Filter]
β Intermediate Set
β [--exclude Filter]
β Final Set for Analysis
# Analyzes the 'src/' directory, first including only C/C++ source files,
# then excluding any of those that are in a 'test/' subdirectory.
git-subtree-report-1 -t src/ -i '\.(c|cpp|h)$' -e '/test/'
# Analyze last month's commits in CI/CD pipeline, excluding secrets
git-subtree-report-1 -C "${BUILD_DIR}" \
-r "$(git rev-list -n1 --since='1 month ago')" \
-t infrastructure/ \
-e '\.secret$' \
-o | tee -a safety-audit-$(date +%Y%m%d).log
$ git-subtree-report-1 1> examples/repo_commit.txt 2> examples/repo_commit.log
Repo Commit Report Repo Commit Log
Note: As of v1.6.0, the report includes a detailed NAME-BASED FILTERING REPORT
section that breaks down which files were selected or rejected by the --include
and --exclude
filters.
git-subtree-report-1 -o -t docs/ | less -R
Outputs clean concatenation of all safe text files with visual separators
Core Requirements
Bash 5.0+
- Modern shell featuresGit 2.20+
- Repository analysisPerl 5.10+
- Advanced text processing
Recommended
less
with-R
support for colored outputterminal-notifier
for macOS desktop alerts
Perfect For
- Pre-commit safety checks
- CI/CD pipeline analysis
- Documentation validation
- Security audits of stored files
- Repository migration planning
Competitive Advantage
π΅οΈ Unlike simple git ls-files
:
- Deep content analysis without checkouts
- Hidden relationship discovery (LFS, submodules)
- Concatenation-ready output formatting
- Historical analysis at any commit
graph TD
A[CLI Arguments] --> B[Git Object Analysis]
B --> C{Filtering Engine}
subgraph C [Filtering Engine]
direction LR
C1[--include / allow-list] --> C2[--exclude / block-list]
end
C --> D[Safety Validation Pipeline]
D --> E[Report Generation]
E --> F[Terminal/File Output]
It should be okay.
We Welcome π Bug Reports βπ‘ Feature Ideas βπ Documentation βπ οΈ Code Contributions
Development Setup
git clone --recurse-submodules https://github.com/da2ce7/git-subtree-report.git
cd git-subtree-report
pre-commit install
Testing
./test/run_tests.sh --suite=full
This project is licensed under the GNU Affero General Public License v3.0 Full License Textββ’βAGPLv3 Explained
Maintained with β€οΈ by Cameron Garnham and AI Open Source Sustainability Sponsor Program Available