Basic Analysis
Generate a comprehensive analysis report:1
Clone the repository
2
Run analysis
.git/filter-repo/analysis/ directory without modifying your repository.3
Review the reports
blob-shas-and-paths.txt- All blob hashes and their pathsdirectories-all-sizes.txt- Directory sizes across all historydirectories-deleted-sizes.txt- Size of deleted directoriesextensions-all-sizes.txt- File types and their sizesextensions-deleted-sizes.txt- Deleted files by extensionpath-all-sizes.txt- Individual file sizespath-deleted-sizes.txt- Deleted filesrenames.txt- File rename history
The analysis mode does not modify your repository. It’s safe to run multiple times.
Understanding the Reports
Largest Files Report
View the biggest files in history:- Unpacked size: Actual file size
- Packed size: Compressed size in Git
- Date deleted: When file was removed (or
<present>if still exists) - Path name: File location
Deleted Files Report
Find large files that were deleted but still bloat history:- No longer exist in the current codebase
- Still take up space in clones
- Slow down clone operations
Extension Analysis
See which file types consume the most space:- Binary files that shouldn’t be in Git
- Large media files better suited for Git LFS
- Compressed files that could be removed
Directory Size Report
Acting on Analysis Results
Once you’ve analyzed your repository, you can clean it up:Remove large deleted files
1
Identify files to remove
Review deleted files:
2
Create removal list
Create
../files-to-remove.txt with paths of files to delete:3
Remove the files
Remove files by extension
Remove all files of a certain type:Remove large directories
Advanced Analysis Techniques
Find duplicate files
Theblob-shas-and-paths.txt report shows all blob hashes. Look for identical hashes:
Track file renames
Therenames.txt report shows file rename history:
Analyze by time period
Combine analysis with Git log to find when large files were added:Continuous Monitoring
Pre-commit checks
Prevent large files from being committed:Regular analysis
Run analysis periodically to catch bloat early:Interpreting Size Differences
Unpacked vs Packed Size
- Unpacked: Actual file size on disk
- Packed: Compressed size in Git objects
- Large difference indicates good compression
- Small difference suggests already-compressed files (zip, jpg, etc.)
Current vs Historical Size
Compare current repository size to historical:Example: Complete Repository Audit
1
Run analysis
2
Generate summary report
3
Identify cleanup targets
Based on the reports:
- Large deleted files: Remove from history
- Binary files: Consider Git LFS
- Build artifacts: Should be in .gitignore
- Old dependencies: Safe to remove
4
Plan cleanup
Create a cleanup plan:
Best Practices
- Run analysis before filtering: Always analyze before making changes
- Keep reports: Save analysis reports for historical reference
- Focus on deleted files: Biggest wins come from removing deleted large files
- Check extensions: Identify file types that shouldn’t be in Git
- Compare before/after: Run analysis again after cleanup to verify
