Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

git-filter-repo

$ git-filter-repo Community High Risk
Elijah Newren · Code & DevOps · MIT · macos / linux / windows

The officially recommended replacement for git filter-branch and BFG Repo-Cleaner for purging large blobs, splitting subdirectories, or scrubbing leaked secrets from Git history. Refuses to rewrite non-fresh clones unless --force is supplied, protecting against accidental history corruption.

FCRS-1.0 Score
78 /100
Good
Medium Confidence
Zero-Friction Install
brew install git-filter-repo
CLI vs MCP Decision CLI Only

Streams git fast-export / fast-import locally over Git internals; impossible and unsafe to delegate to a remote MCP server.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 18 / 25

Fully non-interactive CLI with --analyze and --dry-run, though outputs are plain text files rather than JSON.

  • --analyze produces structured text tables in .git/filter-repo/analysis/
  • Runs headlessly without TTY prompts
Trust & Safety 18 / 25

Built-in fresh-clone check blocks accidental rewrites without --force, and --dry-run previews fast-import output, though history rewriting itself is high-risk.

  • Aborts on non-fresh clones unless --force is passed
  • Rewrites all commit SHAs when executed live
Setup & Portability 13 / 15

Single Python script installable via Homebrew, PyPI, or uvx, requiring Python 3 and Git.

  • Requires git >= 2.22 and Python 3 runtime
Utility & Efficiency 13 / 15

Orders of magnitude faster than git filter-branch for removing secrets or splitting monorepos.

  • Recommended by the Git project over git filter-branch
Maintenance & Lineage 8 / 10

Maintained by core Git contributor Elijah Newren under MIT license.

  • Canonical newren/git-filter-repo repository
Docs & Verifiability 8 / 10

Extensive manpage-style documentation covering examples and safety caveats.

  • Detailed git-filter-repo.txt manual and --help

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Operates purely on local Git repositories with no credentials stored or required.

Side Effects
Read-Only Local Write Destructive
Cost & Quotas

MIT open-source Python tool; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# git-filter-repo Agent Rules
- NEVER run `git-filter-repo --force` on a primary working checkout; always work on a dedicated fresh `git clone`.
- Run `git-filter-repo --analyze` and `--dry-run` first to verify target paths before rewriting refs.

Agent-Ready Command Recipes

Safe Read-Only Queries

Analyze repository size and largest blobs
git-filter-repo --analyze

Generates .git/filter-repo/analysis/ reports summarizing large paths and blobs without rewriting history.

Controlled Writes & Previews

Dry-run path filtering on a fresh clone
git-filter-repo --invert-paths --path secrets.env --dry-run

Writes the proposed fast-import stream to .git/filter-repo/fast-export.filtered without mutating branches or tags.

Strengths for Agents

  • + Refuses to run on dirty or non-fresh clones without explicit --force, preventing common user errors.
  • + --analyze identifies bloated blobs and directories without modifying the repository.
  • + Far faster and safer than legacy git filter-branch.

Caveats & Pitfalls

  • ! Rewrites commit hashes across the entire repository, requiring coordinated force-pushes.
  • ! Output and analysis reports are plain text rather than JSON.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI