git history cleanup

    1

    Safely purge large historical files from Git history to reduce repository size and speed up clones.

    Free

    1 useSecurity scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    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 TypeFile CountTotal Size (MB)Status
    .mp4121,840.50Candidate
    .zip45920.15Candidate
    .iso2450.00Candidate
    .log80115.20Candidate
    .png345.10Candidate

    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

    1. Review the full list in notes/historical-large-blobs.txt and delete any rows you wish to keep.
    2. Type rewrite to proceed with stripping these blobs from the history.
    3. Coordinate with your team to ensure no one pushes to git@github.com:acme/app.git until we finish.

    db-dump-2022.zip

    PDF · document

    Generated

    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-repo to 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

    1. Analysis mode where the agent identifies all historical large files and summarizes them by type and size for your review.
    2. Review and filtering where you edit the generated list to select exactly which blobs to purge from history.
    3. Dry-run verification to calculate expected savings and confirm no selected files are currently in use by any branch.
    4. 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed27 days ago

    What's inside

    Frequently Asked Questions

    Safely purge large historical files from Git history to reduce repository size and speed up clones.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use git history cleanup on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Code Quality & Review

    Free