Surgical removal of unwanted content from git history.
| Command | What it does |
|---|---|
git scrub ai |
Removes AI tool residue: artefact files (.claude/, .cursor/, .codex/ and more) and attribution trailers (Co-Authored-By: Claude, Co-authored-by: Cursor, π€ Generated with [Claude Code]). The patterns cover Claude, Copilot, Cursor, Codex, Aider, Gemini and Windsurf. |
git scrub spill |
Incident response: removes a file or path that got past the preventive layers. You supply the globs, and the tool adds the backup, verify and runbook. spill paths ships. spill text and spill secrets are scaffolded, not wired. |
git scrub supply |
Strips compromised lockfile entries from history across ten package ecosystems (Cargo, npm, pnpm, yarn, bun, uv, pip, poetry, go, composer), from a bundled advisory snapshot or a package list you supply. |
git scrub clean |
Runs any mix of the three above in one pass, with one backup, one verify and one runbook. |
git scrub audit |
A read-only survey of AI residue, supply chain hits and working-tree curation, as one markdown report. |
Each also runs as git-scrub <command>.
More at https://hyperi.io/open-source/git-scrub/.
The binary is git-scrub (hyphenated). Git's third-party subcommand
convention is strict: an executable named git-<name> on PATH is
invokable as both git-<name> and as the git-native subcommand
git <name>. So once installed:
git scrub ai --dry-run
git scrub ai --execute
git-scrub --help
are equivalent surfaces. Pick whichever you prefer.
Released. Each release ships Linux and macOS binaries, .deb and
.rpm packages and a Homebrew formula. See Install below.
What works (cross-platform: Linux + macOS + Windows):
git scrub ai compositeβ strip attribution trailers AND drop AI artefact files in a single engine passgit scrub ai attributionβ attribution trailers onlygit scrub ai filesβ artefact files onlygit scrub ai patternsβ dump the active pattern librarygit scrub ai curateβ working-tree curation (gitignore entries, policy files, stray tool-name references)git scrub spill paths <GLOB>...β purge operator-supplied file globs from historygit scrub supply composite|lockfiles|packages|advisories|patternsβ supply chain scrub across all ten lockfile ecosystems (Cargo, npm, pnpm, yarn, bun text lockfile, uv, pip, poetry, go, composer)git scrub clean [--ai] [--spill-paths <GLOB>...] [--supply]β single-pass composition of any combination of the abovegit scrub audit [--ai] [--supply] [--curate] [--all]β read-only consolidated audit report- Attribution matching is case-insensitive (
(?i)in all patterns) - File patterns match paths anywhere in the tree (nested monorepo sub-directories), not just at the repo root
- Dry-run by default;
--executeto actually rewrite;--auditas a declarative synonym for dry-run on all rewrite subcommands - Mandatory mirror-clone backup to the platform cache dir before any
rewrite (override via
--backup-to; bypass via--no-backup --really-no-backup-i-mean-it) - Post-rewrite verify step β re-grep the scrubbed history for the configured patterns and hard-fail if anything remains
- Markdown runbook written to
<platform-cache-dir>/git-scrub/runbooks/with the plan, backup location, force-push commands, and (whenghis on PATH and authenticated) fork list, closed-PR list, branch- protection state, GitHub Support contact template, and collaborator notification template AI-TRAINING-POLICY.mdandrobots.txtembedded in the binary and written to the working tree byai curate
What's not done yet (still v1):
- Windows packages and
cargo install(see Install below)
What's deferred (v2):
spill textandspill secrets(scaffolded CLI; engine not wired)- Hand-rolled fast-export parser fallback to
git-filter-repofor unusual record forms - Per-package enumeration in supply chain runbook (currently reports blob counts only)
- Standalone: works on any git repo. No project-config dependency, no language-detection, no external infrastructure.
- Opinionated patterns are YAML, not Rust code. All pattern data
ships as YAML files deployed with the binary. Operators can override
via
--config. Editing a YAML file (and rebuilding, or pointing at it via--config) changes behaviour β patterns are first-class config, never hard-coded. - Safe by default. Dry-run is the default. Mandatory backup mirror before any rewrite. Verify pass after rewrite. Tool never pushes for you β emits force-push instructions in the runbook.
- Minimal dependencies. Single static Rust binary. No Python
prerequisite. No hyperi-rustlib pull-in. Engine works via
git fast-export | transform | git fast-importdirectly.
git must be on PATH on every platform. On Windows, the standard
source is Git for Windows, which provides
git.exe and the fast-export / fast-import plumbing git-scrub
shells out to. The optional gh CLI enables
fork enumeration, closed-PR enumeration, and branch-protection probes
in the runbook β install and gh auth login to unlock those sections.
brew install hyperi-io/tap/git-scrubor
curl -fsSL https://raw.githubusercontent.com/hyperi-io/git-scrub/main/packaging/install.sh | sh| Channel | Platform | Status |
|---|---|---|
Homebrew tap (brew install hyperi-io/tap/git-scrub) |
macOS / Linux | each release updates the formula |
curl ... | sh installer |
Linux / macOS | installs the latest release |
| Release tarballs | Linux / macOS, amd64 and arm64 | on every release |
.deb via nFPM |
Debian / Ubuntu, amd64 and arm64 | on every release |
.rpm via nFPM |
Fedora / RHEL, x86_64 and aarch64 | on every release |
.apk via nFPM |
Alpine | planned |
cargo install git-scrub |
Linux / macOS / Windows | planned |
| winget / Scoop / Chocolatey | Windows | planned. Build from source meanwhile |
cargo build --release
./target/release/git-scrub --helpCross-platform CI runs on every push: Linux, macOS, and Windows.
If you are an AI coding agent (Claude Code, Cursor, Copilot, Codex, Aider, β¦) that has been working in someone else's repository, you have probably:
- written working files into
.claude//.cursor//.codex// etc. - written or generated
STATE.md,TODO.md,CLAUDE.mdand friends - left attribution trailers (
Co-Authored-By: <agent>) in commits - introduced lockfile entries or vendored sources you shouldn't have
- referenced your own toolchain by name in comments or docstrings
git-scrub exists so you can find that mess and tidy it up before
handing the repo back.
# 1. Audit. Read-only. One command, full picture.
git-scrub audit
# Or scope it: git-scrub audit --ai --curate
# 2. Fix the working tree (gitignore, policy files, stray references).
# Defaults to interactive; --force skips all prompts.
git-scrub ai curate --execute
# Or in CI / scripted use:
git-scrub ai curate --execute --force
# 3. Fix history (attribution trailers + artefact files).
git-scrub ai composite --execute
# Or just one or the other:
git-scrub ai attribution --execute
git-scrub ai files --execute
# 4. Re-audit. Expect "no issues found".
git-scrub auditEvery --execute subcommand:
- runs dry-run by default β invoke without
--execute(or with the cosmetic--auditflag) to see what would happen - takes a mandatory mirror-clone backup before rewriting history
- runs a post-rewrite verify pass and hard-fails if any pattern still matches
- writes a markdown runbook to the platform cache directory with the force-push commands and the rest of the manual follow-up checklist
- never pushes for you β the runbook tells the operator what to run
git-scrub audit emits one consolidated markdown report covering:
- AI residue (history) β commits with attribution trailers, file operations touching artefact paths
- Supply chain (history) β lockfile blobs matching the bundled advisory snapshot
- Working-tree curation β
.gitignoreentries missing, policy files missing (AI-TRAINING-POLICY.md,robots.txt), stray tool-specific references in comments, files currently tracked that should be gitignored - Summary β exactly the
--executecommands to run next
Pipe it to a file: git-scrub audit --report audit.md. Scope it down
with --ai, --supply, --curate.
- Read the runbook before pushing. The tool prints the
--force-with-leasepush commands; you should not run them unattended. Forks andrefs/pull/N/headreferences are out of the tool's reach β the runbook lists them. - Don't push the AI working files back. After running
ai curateandai composite,.gitignorewill keep them out β but verify withgit statusbefore the next commit. - Don't co-author humans. Never add
Co-Authored-By:trailers for the human operator in commits you author; do not name yourself in commit messages. The cleanup commands look for those exact patterns and will remove them on the next pass. - Audit, don't trust. Run
git-scrub auditagain after any large action to confirm the repo is clean.
Apache-2.0. Copyright HYPERI PTY LIMITED.
