git-filter-repo, filter-repo-rs, BFG or git filter-branch to remove a secret from Git history

Revoke or rotate the secret first. Then rewrite a fresh clone with git-filter-repo, check every branch and tag, and clean the server and other copies separately.

PRACTICAL PICKSPreferredPickOur Preferred PickRemove a secret before sharing$0

git-filter-repo

Removes a file or a string from every branch and tag, including your latest commit, and reports what your host needs to finish the cleanup. GitHub’s procedure is built on it.

Revoke or rotate the secret first. At our October 19 check the latest release was from December 2024, and some fixes are only in its source.

Why git-filter-repo is our Pick
PRACTICAL PICKSRisingStarOur Rising StarRust alternative with backup and preview$0

filter-repo-rs

Documents file and text removal across refs, optional backup bundles and preview, with Windows and macOS support. git-filter-repo remains our first choice for its safety guard and host-cleanup guidance.

Merge simplification is still being optimized for complex histories.

Why filter-repo-rs is our Rising Star

Who is this article for? Developers who have found a password, key or token in a Git repository’s history and need to remove it from every branch and tag before sharing or re-publishing the repository.

About 25 min read

What Preferred Pick, Rising Star and Ready to Rock mean

The quick list

Choose git-filter-repo first; consider filter-repo-rs for its Rust implementation and backup controls. The four tools differ in what they clean by default, how they protect your repository and how much they help you finish the job on the server.

All four are free, open-source tools, checked November 8, 2026. filter-repo-rs needs Git and a stable Rust toolchain for the documented install route. git-filter-repo needs Python 3.6 or later and Git 2.36 or later; BFG needs Java 11 or later; git filter-branch comes with Git. Purging cached copies from a host is done through the host’s own support or tools.

The comparison at a glance

Compare what each tool removes by default, how it protects your repository, and what it leaves for you to clean on the server.

git-filter-repo is our first choice, followed by filter-repo-rs, BFG and git filter-branch for removing a secret before sharing a repository. All tools remain selectable.

Tools for removing a leaked secret from Git history
Featuregit-filter-repofilter-repo-rsBFG Repo-Cleanergit filter-branch
Best fitRemoving a leaked file or string from every branch and tag of a fresh cloneRising Star: Rust alternative with backup and preview; choose git-filter-repo first for its fresh-clone guard and host guidanceNot recommended: dormant project; deletes files and replaces text only after you clean the latest commitOnly when nothing else can be installed; Git itself advises against it
Cost and licence$0; MIT$0; MIT; Git and stable Rust toolchain for documented installation$0; GPL-3.0 or later$0; part of Git (GPLv2)
Your latest commitCleaned like any other commitNo protected-latest-commit exception documented; verify the resultLeft unchanged by default, even if the secret is in itRewritten when included in the refs you name
Safety checksRefuses a repository that does not look freshly cloned unless you pass --force; removes the origin remote after rewritingOptional --backup bundle, --dry-run preview and --write-report; automatic fresh-clone refusal not establishedDocumentation tells you to work on a fresh --mirror clone and keep a backup; warns about protected contentPrints a warning and waits 10 seconds; Git’s manual lists pitfalls that can silently mangle history
Help with server cleanupReports first changed commits, changed refs and orphaned Git LFS files; GitHub’s procedure uses themCommit map, ref map and change summary documented; no equivalent first-changed-commit or orphaned-LFS report establishedYou run reflog expiry and garbage collection yourself; no report for your hostNone
Release record2.47.0, December 4, 2024; fixes since then only in source; release requested since January 2025Stable 1.0.5, June 27, 2026 (Lib.rs, tags and releases checked November 8); development documentation may describe newer features1.15.0, January 18, 2025; no commits sincePart of Git 2.56.0, September 28, 2026; the command itself is no longer developed
Reader reviewsNo reviews yet. Write a reviewNo reviews yet. Write a reviewNo reviews yet. Write a reviewNo reviews yet. Write a review

Choose git-filter-repo first; filter-repo-rs is our Rising Star. All four tools have free, open-source distributions, checked November 8, 2026. None revokes a secret or removes copies held in forks, host caches or other people’s clones. Revoke or rotate the secret first, work on a fresh clone, and check every branch and tag before you push. Incumbent capabilities checked October 19, 2026; filter-repo-rs documentation and all four free licences checked November 8, 2026.

All features and sources 12 criteria

Open the groups that matter to you. They compare the same selected tools. “Planned” means future work, not an available feature. Sources include the published conditions.

What each tool removes

Show 4 criteria
What each tool removes
Featuregit-filter-repofilter-repo-rsBFG Repo-Cleanergit filter-branch
Removing a whole file--invert-paths --path by path in the repository; add each earlier path if the file movedDocuments --path with --invert-paths; glob and regex path filters also described--delete-files by file name, wherever that name appearsA shell command you write, such as an --index-filter running git rm --cached
Replacing a string inside files--replace-text with literal, glob or regular-expression rulesDocuments --replace-text with literal and regular-expression rules--replace-text list; matches become ***REMOVED***A shell command you write for every commit, such as a --tree-filter
Which refs it rewritesAll branches and tags; --sensitive-data-removal first fetches every ref from the sourceDocumentation: --sensitive covers refs including remotes; check every branch and tagAll branches and tagsOnly the refs you name; needs --all and a --tag-name-filter. Keeps old refs under refs/original/
Your latest commitCleaned like any other commitNo protected-latest-commit exception documented; verify the resultLeft unchanged by default, even if the secret is in itRewritten when included in the refs you name
Sources for what each tool removes

Documentation read October 19, 2026: git-filter-repo manual, BFG documentation and git filter-branch manual. For filter-repo-rs, project documentation, Lib.rs and tags read November 8, 2026. Documented behaviour, not measured reliability.

Safety and server cleanup

Show 3 criteria
Safety and server cleanup
Featuregit-filter-repofilter-repo-rsBFG Repo-Cleanergit filter-branch
Safety checksRefuses a repository that does not look freshly cloned unless you pass --force; removes the origin remote after rewritingOptional --backup bundle, --dry-run preview and --write-report; automatic fresh-clone refusal not establishedDocumentation tells you to work on a fresh --mirror clone and keep a backup; warns about protected contentPrints a warning and waits 10 seconds; Git’s manual lists pitfalls that can silently mangle history
Help with server cleanupReports first changed commits, changed refs and orphaned Git LFS files; GitHub’s procedure uses themCommit map, ref map and change summary documented; no equivalent first-changed-commit or orphaned-LFS report establishedYou run reflog expiry and garbage collection yourself; no report for your hostNone
What hosts publishGitHub’s procedure uses it (2.47 or later). Bitbucket Cloud names it as an alternativeNo host procedure in our sources recommends itBitbucket Cloud’s guidance leads with it; GitHub’s current procedure does not mention itBitbucket Cloud calls it “risky, complicated, and not recommended in general”; GitLab’s undo page still shows an example
Sources for safety and server cleanup

Read October 19, 2026: the three manuals above and host guidance from GitHub, GitLab and Bitbucket Cloud. filter-repo-rs backup and report features: documentation, read November 8, 2026. No tool revokes a secret or cleans forks, caches or other clones.

Setup, maintenance and security

Show 4 criteria
Setup, maintenance and security
Featuregit-filter-repofilter-repo-rsBFG Repo-Cleanergit filter-branch
Cost and licence$0; MIT$0; MIT; Git and stable Rust toolchain for documented installation$0; GPL-3.0 or later$0; part of Git (GPLv2)
InstallPython 3.6+ and Git 2.36+; Homebrew, Debian, Scoop, PyPI. About 87,600 Homebrew installs in 12 monthsGit on PATH and stable Rust toolchain; install with cargo; Windows x64, macOS Intel/ARM and Linux targets documentedJava 11+; one jar; Homebrew. About 6,300 Homebrew installs in 12 monthsAlready installed with Git, including Git for Windows
Release record2.47.0, December 4, 2024; fixes since then only in source; release requested since January 2025Stable 1.0.5, June 27, 2026 (Lib.rs, tags and releases checked November 8); development documentation may describe newer features1.15.0, January 18, 2025; no commits sincePart of Git 2.56.0, September 28, 2026; the command itself is no longer developed
Known problemsRelease: glob replacement rules can fail on Python 3.14; fails with multi-line Git config values; can crash in --sensitive-data-removal with LFS plus submodules (Debian patches the first two)Project warns merge simplification is still being optimized for complex histories; support responsiveness unknown; issue index lists zero open and closed issuesBundled JGit 6.10.0 is within a moderate 2025 advisory’s range; open report of crashes with replacement lists over about 1,550 linesGit’s manual: “its use is not recommended”. Git: July 2025 flaw (CVE-2025-48384) exploited in attacks; fixed in 2.50.1 and patch releases back to 2.43.7
Sources for setup, maintenance and security

Earlier hands-on check, October 3, 2026

Show 1 criteria
Earlier hands-on check, October 3, 2026
Featuregit-filter-repofilter-repo-rsBFG Repo-Cleanergit filter-branch
Earlier hands-on check, October 3, 2026 (historical)2.47.0: removed an invented file and inline string from all reachable branches and the tag of a seven-commit synthetic mirror; refused a non-fresh cloneNot part of the October 3 check; evaluated from public documentation1.15.0: same result on the base mirror; with both strings also in the latest commit, exited successfully with a warning and both strings remainedNot part of the check
Sources for earlier hands-on check, october 3, 2026

Historical observation from a small Linux check run on October 3, 2026, before Practical Picks adopted its research-only method later that day. It used one synthetic seven-commit repository with invented, never-valid strings and did not decide any recommendation. The system’s Git reported version 2.43.0; upstream 2.43.0 falls within the affected range of CVE-2025-48384, and the record does not show whether that system’s package carried the distribution’s backported fix. Earlier check record, October 3, 2026.

What matters when choosing

Revoke or rotate the leaked password, key or token before you touch the history. Anyone who copied the repository while the secret was in it may still have it, and no tool here can reach their copy. Once the secret is revoked it no longer grants access, and git-filter-repo’s manual and GitHub both say that may solve the problem without rewriting anything. Rewrite the history as well when the secret cannot be changed, when the repository is about to be shared, or when policy requires it. GitHub Support will only help purge sensitive data when it judges that rotating the credentials cannot remove the risk. git-filter-repo manual, GitHub’s guidance

git-filter-repo is our Preferred Pick for removing a secret from every branch and tag of a repository before you share or re-publish it. Git’s own manual recommends it in place of git filter-branch, and GitHub’s removal procedure is built on it and asks for version 2.47 or later. It deletes a whole file by its path or replaces a string inside files, across all branches and tags, and it cleans your latest commit as well as older ones. Its --sensitive-data-removal mode first fetches every ref from the repository you cloned, then reports the first changed commits, the refs it rewrote and any Git LFS files left orphaned, which is what GitHub Support asks for. It refuses to run on a copy that does not look like a fresh clone unless you pass --force. The compromise is its release record. At our October 19 check, the latest release was 2.47.0, dated December 4, 2024. Later fixes, including one for replacement rules on Python 3.14 and one for a crash with Git LFS and submodules, exist only in its source code or in Debian’s patched package, and users have asked for a new release since January 2025 without a reply from the maintainer in that thread. Project, Git’s warning about filter-branch, release request

filter-repo-rs is our Rising Star for developers who want a Rust alternative with backup, preview and change reports. Its documentation covers file deletion and text replacement across refs, and it supports Windows and macOS. git-filter-repo remains our first choice for its fresh-clone guard, fuller documentation and host-cleanup reports. filter-repo-rs warns that merge simplification is still being optimized for complex histories; keep the original repository and verify the result before sharing it. Project documentation, release history, checked November 8, 2026.

BFG Repo-Cleaner is simpler but we do not recommend starting with it. Its last release and human commits were in January 2025. It also leaves your latest commit alone by default. It deletes files by name and replaces listed strings in one command, and Bitbucket Cloud’s guidance still leads with it. By design it does not change the files in your current commit, so a secret still present there survives a run that reports success. Remove it from the latest commit first. Its jar bundles a version of the JGit library that a May 2025 advisory covers. BFG documentation, Bitbucket Cloud guidance

Do not use git filter-branch for this job. It comes with Git, but Git’s own manual says it has “a plethora of pitfalls that can produce non-obvious manglings” of history, that they “cannot be backward compatibly fixed”, and that “its use is not recommended”. git filter-branch manual

A local rewrite cleans one copy. After you force-push the rewritten history, the old commits can still be reached through forks, other people’s clones, pull requests and the host’s cached views. GitHub asks you to contact its Support team to remove cached views and pull-request references. Bitbucket Cloud asks you to open a support case so that it can remove leftover references and run garbage collection. GitLab says not to use a git-filter-repo purge for passwords or keys and offers its own Remove blobs and Redact text tools to project Owners instead, so if the repository already lives on GitLab, follow GitLab’s procedure. Everyone with a clone should delete it and clone again; one old copy pushed back can bring the secret back. Whichever tool you use, keep Git itself updated: a July 2025 Git flaw, CVE-2025-48384, is on the US government’s list of vulnerabilities exploited in attacks. GitLab: remove data from a repository, CISA catalog

git-filter-repo

Preferred Pick · remove a secret before sharing

$0MIT · single Python script

Choose git-filter-repo to remove a leaked file or string from every branch and tag of a fresh clone, after you have revoked the secret. Use --sensitive-data-removal and check the result before you push.

Reasons to choose it

  • Recommended by Git in place of filter-branch; GitHub’s removal procedure is built on it
  • Removes files by path and strings by rule, including in your latest commit
  • Reports first changed commits, changed refs and orphaned LFS files for your host

What to watch

  • Latest release at October 19 check: 2.47.0 from December 2024; later fixes only in source or distribution patches
  • On Python 3.14 the release’s glob replacement rules can fail to match
  • Needs Python 3.6+ and Git 2.36+; --force skips its fresh-clone safety check

git-filter-repo removes a whole file with --invert-paths --path followed by the file’s path in the repository, and you can add more --path arguments if the file was moved or renamed. To keep a file but remove a string from it, list the string in a replacement file and pass --replace-text; rules can be literal text, glob patterns or regular expressions. It rewrites every branch and tag, including your latest commit. With --sensitive-data-removal (--sdr), added in 2.47.0, it first fetches all refs from the repository you cloned, so refs outside branches and tags are cleaned too, and at the end it reports the first changed commits, the changed refs and any Git LFS objects orphaned by the rewrite. GitHub’s procedure uses those reports to count the affected pull requests and to brief its Support team. The manual also gives two commands to check the result: git log --all --name-status -- followed by the file’s path, and git log -S followed by the string with --all -p. Manual, GitHub’s procedure

Its main safety check is the fresh-clone test: it refuses to rewrite a repository that does not look freshly cloned, because a rewrite there could discard work that exists nowhere else. --force skips that check, and the manual warns against using it out of habit. It also removes the origin remote after a rewrite, which its manual describes as a cheap way to stop the old and new histories being mixed by an accidental push. The --sensitive-data-removal fetch can overwrite local changes that were never pushed; the manual’s advice is to work in a fresh clone, or pass --no-fetch and accept that refs you do not have may keep the secret. A rewrite changes commit IDs from the first changed commit onward, and git-filter-repo drops commit and tag signatures. Manual: fresh-clone check and --force

Read the full git-filter-repo analysis and sources

The October 19 documentation describes a single Python script, free under the MIT licence, and needs Python 3.6 or later and Git 2.36 or later. Homebrew, Debian, Scoop and PyPI package it; Homebrew recorded about 87,600 installs in the 12 months to October 19, 2026. On Windows you need a working Python, and the install guide describes problems with the Python stub that Windows ships. The weak point is releases. As of October 19, 2026, 2.47.0, from December 4, 2024, was the latest, although fixes have continued in the source, most recently in July 2026. Three known problems in that release matter here. On Python 3.14, the release’s glob: replacement rules can fail to match, so text you meant to remove can stay; the source fix concerns only glob rules. The release fails to run when your Git configuration contains a multi-line value; Debian patched this in December 2024 and Python 3.14 support in March 2026. And with --sensitive-data-removal, the release can crash on repositories that use both Git LFS and submodules. A request for a new release has been open since January 2025, and in July 2026 a user reported that one step took about five hours on a large repository on Windows with 2.47.0 against 110 seconds with the current source. No security advisory for git-filter-repo was found in GitHub’s advisory database, OSV or NVD. Install guide, Python 3.14 fix, LFS and submodules fix, Debian bug 1091422, Debian bug 1131794, release request

In an earlier hands-on check on October 3, 2026, before we adopted our research-only method, git-filter-repo 2.47.0 rewrote a separate mirror of a seven-commit synthetic repository on Linux. It removed an invented secret file and an invented inline string from every reachable branch and tag, kept an unrelated file, the branch and tag names and a merge, and pruned two commits that became empty. Run on a normal clone with a new local commit, it refused without --force and left the history unchanged. The check did not cover --sensitive-data-removal, Git LFS, submodules, signed commits, large repositories or a push to a server. Earlier check record, October 3, 2026

Used git-filter-repo? Share your experience to help other readers choose.

filter-repo-rs

Rising Star · Rust alternative with backup and preview

$0MIT · Git and stable Rust toolchain

Consider filter-repo-rs if you prefer a Rust alternative and can inspect the rewritten result carefully. Keep the original repository; choose git-filter-repo for more complete host-cleanup guidance and complex histories.

Reasons to choose it

  • Documents file deletion and text replacement, with --sensitive covering refs including remotes
  • Optional backup bundle, preview and commit/ref maps
  • Install instructions cover Windows, macOS and Linux

What to watch

  • Merge simplification is still being optimized for complex histories
  • Development documentation may describe features newer than stable 1.0.5
  • Support responsiveness unknown; no host-specific LFS cleanup report established

filter-repo-rs is an MIT-licensed Rust implementation inspired by git-filter-repo, maintained by Cactusinhand. Its documentation shows --replace-text for literal and regular-expression rules, --path with --invert-paths for removing files, and --sensitive for covering refs including remotes. Choose it if you prefer a Rust tool and are prepared to inspect the rewritten repository carefully. We have not established a speed advantage for this job. Project documentation, checked November 8, 2026.

The project documents --backup to create a timestamped Git bundle, --dry-run to preview changes, and --write-report to produce commit and ref maps and a change summary. Its recovery example clones the backup bundle into a separate repository. These are useful controls, but we did not establish an automatic fresh-clone refusal or reports equivalent to git-filter-repo’s first changed commits and orphaned LFS objects. Revoke the secret first, work on a fresh copy and check every branch and tag yourself. Backup and recovery documentation, checked November 8, 2026.

Read the full filter-repo-rs analysis and sources

The main limit is explicit: merge simplification is still being optimized for complex histories. Incremental processing with --state-branch is also absent. For a complicated merge history, git-filter-repo is the better-supported choice. The install instructions require Git and a stable Rust toolchain and list Linux, Intel and Apple Silicon macOS, and Windows x64 targets. Lib.rs lists stable version 1.0.5 dated June 27, 2026; the project’s tags include public betas and 1.0.0 on February 21, 2026. Some features described on the development branch may postdate that release. Documentation, tags, releases, issues, package record, checked November 8, 2026.

The project’s security page lists no published advisories and no security policy. That is not a guarantee of safety. Its issue index showed zero open and zero closed issues on November 8, and its releases page listed 1.0.5 as the latest release. An empty tracker does not establish support responsiveness; we found no relevant independent account of a completed cleanup in the discussions available to us. The recommendation rests on attributed documentation, with uncertainty about complex merges and support responsiveness. Security page, issues, releases, checked November 8, 2026.

Used filter-repo-rs? Share your experience to help other readers choose.

BFG Repo-Cleaner

Not recommended · dormant project

$0GPL-3.0 or later · Java 11+ jar

BFG has had no release or human commit since January 2025. Prefer git-filter-repo; if maintaining an existing BFG workflow, remove the secret from your latest commit first. Then expire the reflog, run garbage collection and check every branch and tag.

Reasons to choose it

  • Deletes files by name and replaces listed strings in one command
  • Bitbucket Cloud’s guidance leads with it
  • One jar with no other dependencies besides Java

What to watch

  • Leaves your latest commit unchanged by default, even when the secret is in it
  • No release or commit since January 2025; bundled JGit is covered by a 2025 advisory
  • Open report of crashes with replacement lists over about 1,550 lines

The November 8 commit record still ends on January 18, 2025, with no release or human commit in the past year. That maintenance gap rules out a recommendation here. Commit history, checked November 8, 2026.

BFG works on a bare --mirror clone. --delete-files removes every file with a given name wherever it appears in history, and --replace-text replaces each string in a list with ***REMOVED***. Its documentation says it is 10 to 720 times faster than git filter-branch. It does not delete the old data from disk itself: afterwards you run git reflog expire --expire=now --all and git gc --prune=now --aggressive, then push. Bitbucket Cloud’s guidance, updated September 25, 2025, walks through BFG and names git-filter-repo as an alternative with more features; GitHub’s current procedure does not mention BFG. BFG documentation, Bitbucket Cloud guidance

Read the full BFG Repo-Cleaner analysis and sources

The catch for this job is that your latest commit is protected. BFG’s documentation says it “doesn’t modify the contents of your latest commit” on your current branch, and that anything still in a protected commit “won’t be deleted - it’ll persist in your repository”. So commit the removal of the secret first, take a fresh mirror and then run BFG, or turn protection off with --no-blob-protection, which the project does not recommend in general. Deleting by file name also matches files with the same name in other folders. BFG gives no report of first changed commits or orphaned LFS objects for your host. In an open October 2024 report, a user who cleaned a repository with BFG and force-pushed could still open the secret on GitHub through the old commit’s address, which is the cached-view limit GitHub documents. BFG documentation, issue 521

BFG is a single jar, free under the GPL version 3 or later, and needs Java 11 or later. Homebrew packages it, with about 6,300 installs in the 12 months to October 19, 2026. Version 1.15.0, released January 18, 2025, updated the bundled JGit and Scala libraries after a user’s security scanner flagged them; there have been no commits since. That release bundles JGit 6.10.0, which falls within the range of a moderate JGit advisory published in May 2025 (CVE-2025-4949, fixed in 6.10.1). The flaw is in JGit’s repo-manifest parser and an experimental Amazon S3 transport; we did not establish whether BFG can reach either, but scanners may flag the jar again. An open January 2025 report says --replace-text crashes with a stack-overflow error when the list has more than about 1,550 lines; the reporter’s workaround is to split the list into smaller files. Roberto Tyley wrote BFG and published 1.15.0. Its tracker had 264 open issues on October 19, 2026, and none of the open reports we read from 2024 and 2025 has a reply from him. 1.15.0 release, issue 526, bundled JGit version, JGit advisory, issue 528

In an earlier hands-on check on October 3, 2026, before we adopted our research-only method, BFG 1.15.0 removed the same invented file and string from a separate mirror of the seven-commit synthetic repository and kept all seven commits, the branch and tag names and the merge. In a second copy with both invented strings also in the latest commit, BFG warned about protected content and exited successfully, and both strings were still there, as its documentation predicts. The check did not run the reflog expiry and garbage collection that BFG asks for. Earlier check record, October 3, 2026

Used BFG Repo-Cleaner? Share your experience to help other readers choose.

git filter-branch

Not recommended · built into Git

$0Part of Git · GPLv2

Avoid git filter-branch for removing secrets. Git’s own manual says its use is not recommended and points to git filter-repo. Use it only if you cannot install anything else, and follow its safety section closely.

Reasons to choose it

  • Already installed wherever Git is, including Git for Windows
  • Can run any shell command on each commit
  • Receives Git’s security fixes

What to watch

  • Git’s manual lists pitfalls that can silently mangle history
  • Rewrites only the refs you name and keeps old refs that still hold the secret
  • Very slow on large histories

git filter-branch ships with Git, including Git for Windows, so it needs no installation. You supply shell commands that run on each commit, for example an --index-filter that removes a file. It rewrites only the refs you name, so you must pass --all for every branch and a --tag-name-filter to rewrite tags, and it keeps the original refs under refs/original/, which still hold the secret until you delete them and clean up. git filter-branch manual

Git’s own manual advises against it. It calls the command “glacially slow” and lists safety problems: shell filters that behave differently on other systems, file names with spaces or non-ASCII characters mishandled or silently removed, old and new history easily mixed so that some copies of commits still hold the sensitive files, and annotated tags turned into lightweight tags. It concludes that “its use is not recommended” and points to git filter-repo. Since Git 2.24, the command itself prints a warning and waits 10 seconds before it starts. GitLab’s page on undoing changes still shows a git filter-branch example; Bitbucket Cloud calls it “risky, complicated, and not recommended in general”. git filter-branch manual, Git 2.24 release notes, Bitbucket Cloud guidance

Read the full git filter-branch analysis and sources

Because it is part of Git, it receives Git’s security fixes. Git’s most serious recent flaw, CVE-2025-48384, published July 8, 2025, lets a repository with a crafted submodule run a script when you clone it with its submodules. It is fixed in 2.43.7, 2.44.4, 2.45.4, 2.46.4, 2.47.3, 2.48.2, 2.49.1, 2.50.1 and later, and CISA added it to its catalog of exploited vulnerabilities on August 25, 2025. Git’s advisory list shows nothing newer as of October 19, 2026. Git for Windows publishes its own advisories: six since March 2026, including two that let a malicious server or repository leak a Windows password hash during a clone, and two that list no patched version. Linux distributions often fix Git without changing its version number, so check your system’s security notices, not only git --version. The current release is Git 2.56.0, from September 28, 2026. CVE-2025-48384 advisory, Git advisories, Git for Windows advisories, Ubuntu notice

Used git filter-branch? Share your experience to help other readers choose.

Which product are we missing?

Know a product that belongs in this article? Tell us what it does differently and why it deserves a closer look. Newcomers welcome.

Readers and product teams can suggest candidates. Suggestions inform our research; they do not guarantee inclusion or a recommendation.

Suggest a product

Opens an email draft with this article attached as a link. Nothing is sent until you send it.

No email app? Send the product name, website, and this article’s title to admin@practicalpicks.guide.

What people are saying

We have no Practical Picks reader reviews for these tools yet.

The project issue trackers show the mistakes these tools punish. In September 2026, a git-filter-repo user reported losing about two weeks of work after leaving out --invert-paths, which kept only the folder they meant to delete; another user replied that git-filter-repo removes the remote to prevent accidental pushes but cannot protect a purely local repository. In January 2026, another user reported a damaged history, found with git fsck, after running git-filter-repo with --force on a working repository; it has no maintainer reply. Both are individual reports, not failure rates, and both argue for working on a fresh clone and keeping the original until you have checked the result. On BFG’s tracker, an open report describes a secret still visible on GitHub after a BFG rewrite and force-push, and another a crash with a long replacement list. git-filter-repo issue 769, issue 734, BFG issue 521, BFG issue 528

In July 2026, a Hacker News discussion of git-filter-repo drew thanks from developers who had used it to move code between repositories, and one commenter listed removing accidentally committed keys and passwords among the reasons to rewrite history. Another warned that anyone with an old copy could push it back. Hacker News discussion

How we researched

This is public-source research. For this comparison we did not install, run or test any of these tools, create accounts or contact the projects. Our sources were each project’s documentation, release and commit records, issue trackers, security advisories (GitHub, OSV, NVD and CISA), package records (Homebrew, Debian and PyPI), the removal guidance published by GitHub, GitLab and Bitbucket, and user discussions, read on October 19, 2026, with the newcomer, licence and maintenance sources identified below checked on November 8, 2026. No project supplied access or payment, and our links carry no affiliate tracking.

This article first appeared on October 3, 2026, and then rested mainly on a small hands-on check run that day, before we adopted our research-only method later that day. We keep that check as a dated observation. On Linux, git-filter-repo 2.47.0 and BFG 1.15.0 each cleaned a separate mirror of a seven-commit synthetic repository holding an invented file secret and an invented inline string, and we also checked git-filter-repo’s fresh-clone refusal and BFG’s latest-commit protection. The system’s Git reported version 2.43.0. Upstream 2.43.0 is inside CVE-2025-48384’s affected range, but distributions backport fixes under the same number (Ubuntu fixed its 2.43.0 package in July 2025), and the record does not show which package build that system had. The check shows what happened once in that setup, not how the tools behave on large or real repositories, and it did not decide any recommendation here. Earlier check record, October 3, 2026

We wrote this for a developer who has found a password, key or token in a Git repository’s history and needs to remove it from every branch and tag of a copy before sharing or re-publishing the repository. Before scoring, we fixed four criteria and their weights: removal coverage, meaning what each tool removes and from where by default (35%); safety and verification (25%); maintenance and security (20%); and setup and documentation (20%). Cost carried no weight in those criteria. All four tools have free, open-source distributions, checked November 8, 2026. git-filter-repo scores 3.98 out of five, followed by filter-repo-rs at 3.58, BFG at 3.00 and git filter-branch at 2.58. The advantage over filter-repo-rs comes from its removal coverage, fresh-clone guard and documentation. The October 19 comparisons with BFG and git filter-branch also favored git-filter-repo when maintenance or setup carried more weight.

We checked that every widely used option for this reader was either compared or set aside for a stated reason. GitHub and Bitbucket publish procedures rather than tools; GitHub’s uses git-filter-repo, and Bitbucket’s leads with BFG. GitLab’s Remove blobs and Redact text work only on projects hosted on GitLab and need the Owner role, and Remove blobs does not work on some forked projects, so we describe them as the route for GitLab-hosted repositories rather than as local tools. Secret scanners such as gitleaks and TruffleHog find secrets in history but do not remove them; they can help you list what to remove and confirm the result. Git’s experimental git history command edits one commit at a time and does not handle merges, and helper commands that wrap git filter-branch, such as git-extras’ git obliterate, inherit its problems. On November 8, 2026, we examined GitHub repository searches and a Git-history directory, Lib.rs and Hacker News results for newer alternatives. filter-repo-rs earns our Rising Star for its documented file and text removal, backup and preview controls, and Windows/macOS support. Its complex-merge limitation keeps git-filter-repo ahead. Git-Secret-Scrubber’s January 2026 release documents whole-file removal; text replacement appears only in later development work, so it does not establish the complete job here. RedBeret’s git-clean-history documents a source-installable wrapper around BFG or filter-branch, but not specific whole-file and text removal across every branch and tag. Search results for leak-lock, git-regret and Git-Secret-PII-Sanitizer did not establish a complete released workflow. Scanner results, including leakhound and credsweep, did not establish history rewriting. Demonstrations in git-filter-repo’s own repository and helpers built on filter-branch do not establish a better-supported alternative to the underlying tool. Dated repository search, Git-Secret-Scrubber release, RedBeret documentation, checked November 8, 2026.

ToolPublic sourcesWhat remains uncertain
git-filter-repoREADME, manual, install guide, release and commit history, issue tracker, Debian bug reports and patches, Homebrew and PyPI records, GitHub’s removal procedure, GitHub advisory database, OSV and NVD searches.When a new release will ship, whether the January 2026 damage report reflects a bug, behaviour on very large repositories and on Windows.
filter-repo-rsProject documentation, tags, releases, issue index, Lib.rs package record, maintainer profile, security page and discussion searches, checked November 8, 2026.Complex-merge behavior, which development features are released, and support responsiveness remain uncertain; zero listed issues does not resolve those limits.
BFG Repo-CleanerProject page, README, 1.15.0 release, build file, issue tracker, JGit advisory, Homebrew record, Bitbucket Cloud guidance.Whether BFG can reach the flawed JGit code, whether the project will release again, how often protected content is missed in practice.
git filter-branchGit manual, Git 2.24 release notes, Git and Git for Windows advisories, CISA record, Ubuntu security notice, GitLab and Bitbucket guidance.Fix status of two Git for Windows advisories that list no patched version, whether the October 3 system’s package carried the backported fix.

None of these sources measures how often a rewrite misses data or damages a repository. Next substantive review is due January 17, 2027, or sooner if git-filter-repo or BFG publishes a release or a security advisory changes this job. Found a change? Contact the editors.

Sources and evidence

Checked November 8, 2026: git-filter-repo repository and licence; filter-repo-rs documentation and licence, tags, releases, issues, package record, maintainer, security page; Git-Secret-Scrubber release and development history; BFG documentation, licence and maintenance; Git licence, Git advisories and Git for Windows advisories. The incumbent capability and issue evidence below remains dated October 19.

Checked October 19, 2026: git-filter-repo project and README, manual, install guide, licence, 2.47.0 release, commits for Python 3.14 and LFS with submodules, issues 638, 734 and 769, Debian package, Debian bugs 1091422 and 1131794, Homebrew and PyPI; BFG Repo-Cleaner documentation, repository, 1.15.0 release, build dependencies, issues 521, 526 and 528, JGit advisory GHSA-vrpq-qp53-qv56 and Homebrew; Git filter-branch manual, 2.24 release notes, downloads and current release, security advisories, CVE-2025-48384 advisory, CISA exploited-vulnerabilities catalog, Git for Windows advisories, Ubuntu USN-7626-1 and git-extras git obliterate; host guidance from GitHub, GitLab and Bitbucket Cloud, updated September 25, 2025; the Hacker News discussion, July 2026; and the earlier check record, October 3, 2026. No project supplied access or influenced the conclusion. No affiliate links were used. Recheck releases, advisories and host procedures before any public release.

No screenshots are shown: these are command-line tools, and this comparison is based on public sources. The earlier check record, October 3, 2026 describes the synthetic repository used in a small check before our research-only method.