- Home
- Skills
- Code Quality & Review
- git history cleanup
git history cleanup
Safely purge large historical files from Git history to reduce repository size and speed up clones.
Free
Works with the AI Agents you already use
git history cleanup
Example session with this skill installed
My repository is 4GB and takes forever to clone. I need to find all files over 10MB in the history that aren't in the current main branch and delete them. The remote is git@github.com:acme/app.git.
- Read your context and instructions
- Compiled the git history cleanup
- Generated the document
I have initialized the cleanup environment and analyzed the repository history. I found 142 historical blobs exceeding 10MB that are not present in any current branch or tag.
Git History Audit Results
| File Type | File Count | Total Size (MB) | Status |
|---|---|---|---|
| .mp4 | 12 | 1,840.50 | Candidate |
| .zip | 45 | 920.15 | Candidate |
| .iso | 2 | 450.00 | Candidate |
| .log | 80 | 115.20 | Candidate |
| .png | 3 | 45.10 | Candidate |
Largest Candidates for Removal:
assets/videos/hero-background-old.mp4(412.55 MB)backups/db-dump-2022.zip(215.10 MB)temp/build-archive-v1.iso(205.00 MB)logs/debug-trace-heavy.log(88.40 MB)
I have created a full mirror backup in REPO-backup.git and verified the current tree state. No selected files are currently live.
Next steps
- Review the full list in
notes/historical-large-blobs.txtand delete any rows you wish to keep. - Type
rewriteto proceed with stripping these blobs from the history. - Coordinate with your team to ensure no one pushes to
git@github.com:acme/app.gituntil we finish.
db-dump-2022.zip
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Git repositories often become bloated and slow to clone due to large files committed months or years ago. Even if you delete those files today, they persist in your .git folder history, inflating clone times and storage costs. This skill provides a methodical, risk-aware procedure to purge historical large blobs while ensuring your current code remains untouched.
What it does
- Identifies historical blobs by scanning the entire repository history to find files exceeding a user-defined size threshold.
- Protects live data by automatically cross-referencing candidates against all current branches and tags to prevent accidental deletion of active files.
- Rewrites history safely using
git-filter-repoto strip selected large files from every past commit, reducing packfile size. - Verifies tree integrity by comparing tree IDs before and after the operation to guarantee current file contents haven't changed.
- Generates size audits providing detailed reports on uncompressed data removal and final repository footprint.
How it works
- Analysis mode where the agent identifies all historical large files and summarizes them by type and size for your review.
- Review and filtering where you edit the generated list to select exactly which blobs to purge from history.
- Dry-run verification to calculate expected savings and confirm no selected files are currently in use by any branch.
- Rewrite and push executed only after explicit string confirmations, followed by a remote integrity check.
Frameworks & tools
This skill utilizes git, git-filter-repo, and standard Unix utilities like awk, comm, and sha256sum. It supports Bash, Zsh, and Fish shells.
Why this beats prompting it yourself
Manual history rewrites are dangerous and often result in lost tags or corrupted branches. This skill enforces a 17-step safety protocol that includes mandatory backups, tree-hash verification, and specific protection against pushing to a remote that has changed during the cleanup process.
Use cases
- Shrinking legacy repos that have ballooned due to old VM images, database dumps, or 4K video assets.
- CI/CD optimization to reduce clone times and runner disk usage for repositories with heavy history.
- Pre-LFS migration to clean up the repository before moving active large assets into Git LFS.
- Post-leak cleanup to remove large binary files that were accidentally committed before being added to
.gitignore.
Known limitations
Requires git-filter-repo installed on the host. Does not remove history from remote forks, pull request refs, or server-side caches, which may require host-provider support to fully purge.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.
Requires git-filter-repo. Cannot delete history from remote forks or pull request refs. Collaborative repos require a push freeze and re-cloning by all users.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 27 days ago
- Free with an Agensi account
- Software
Git