git-filter-repo provides a purpose-built way to rewrite the history of a Git repository. It is intended for jobs in which the existing sequence of commits needs to be transformed, such as removing accidentally committed credentials, extracting part of a project or reorganising directory paths across old revisions.
History rewriting changes commit identities and can disrupt other clones, branches and collaborators. The utility therefore protects against accidental use by expecting a fresh clone unless the user deliberately overrides the safety check. It can also analyse a repository before destructive changes are made.
Because history transformations alter hashes, a rewritten repository is normally distributed deliberately rather than mixed with its old version. The reporting mode is useful before changing anything, and the dry-run option lets experienced users inspect how a proposed set of filters would behave.
This is free and open source software.
Key Features
- Filters historical commits by file path, directory, glob or regular expression, retaining or excluding selected content.
- Removes unwanted large objects, sensitive strings, files or entire directories from old commits.
- Rewrites filenames and directory layouts across history, including moves into subdirectories and extracted subprojects.
- Changes commit messages, tags, author information and other historical metadata when requested.
- Supports callback-based transformations for more specialised history-rewriting tasks.
- Provides repository analysis reports to help identify large or problematic historical objects.
- Prunes commits left empty by filtering and handles degenerate merges arising from rewritten history.
- Rewrites commit references in messages and can maintain replacement references for previous commit hashes.
- Repacks the transformed repository to help reclaim storage after filtering.
- Refuses normal destructive rewriting outside a fresh clone unless explicitly forced.
Website: github.com/newren/git-filter-repo
Support:
Developer: Elijah Newren
License: MIT License

git-filter-repo is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Git Tools for Diff Review and Repository History | |
|---|---|
| difftastic | Structural diff tool that compares files based on their syntax |
| git-filter-repo | Quickly rewrite git repository history |
| onefetch | Displays information about a local Git repository |
| git-stats | Local git statistics including GitHub-like contributions calendars |
| diff-so-fancy | Attractive diffs with diff-highlight and more |
| BFG Repo-Cleaner | Clean unwanted data from Git repository history |
| git-delta | Viewer for git and diff output |
| gitlogue | Cinematic Git commit replay tool |
| git-quick-stats | Access various statistics in a git repository |
| git-who | Command-line Git analysis tool |
| git-standup | Recall what you did on the last working day |
| git-of-theseus | Analyze how a Git repo grows over time |
| git-sizer | Compute various size metrics for a git repository |
| diffnav | Git diff pager based on delta but with a file tree, à la GitHub |
| critique | Terminal UI for reviewing git diffs |
| git-big-picture | Visualization tool for Git repositories |
| hercules | Gain advanced insights from Git repository history |
| keifu | TUI that visualizes Git commit graphs |
| git-fame | Git repository collaborators sorted by contributions |
| needle | Highlights GitHub PRs |
| mergiraf | Git merge driver |
| git-history | Analyze Git history using SQLite |
| ec | Terminal Git mergetool |
| diffr | Word-by-word diff highlighting utility |
| git-scope | Fast TUI dashboard to view the git status of all your repositories |
| mamediff | Manages unstaged and staged Git diffs |
| deadbranch | Keep Git repositories tidy |
| GitTop | Lightweight desktop client for GitHub notifications |
| git-heatmap | Generates a customizable heatmap |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.