The fastest way to rewrite Git history
Ever pushed commits and then realized you messed up?
- Wrong Git user/email.
- Bad commit messages.
- Accidentally committed secrets (API keys, passwords).
- A huge file is bloating the repo.
- ...and more.
Many developers try git rebase -i
, but it’s slow, manual, and limited. A better way?
Use git-filter-repo, it’s faster, more powerful, and works across the entire repo.
Examples of Git problems and fixes
Fix author name/email in all commits
git filter-repo --commit-callback ' commit.author_name = "Correct Name" commit.author_email = "[email protected]" '
Edit commit messages in bulk
git filter-repo --message-callback ' commit.message = commit.message.replace(b"fix typo", b"Fix: corrected typo") '
Remove sensitive files from history
git filter-repo --path secret-file.env --invert-paths
Delete large files from old commits
git filter-repo --strip-blobs-bigger-than 100M
Erase all commits from a specific author
git filter-repo --commit-callback ' if commit.author_email == b"[email protected]": commit.skip() '
For more use cases, check out the full docs.