Skip to content
Tech News
← Back to articles

Quickly rewrite Git repository history

read original more articles
Why This Matters

git filter-repo is a powerful and scalable tool recommended by the Git project for rewriting repository history, offering significant improvements over the traditional git filter-branch. Its versatility allows both simple command-line use and advanced custom tool creation, making it valuable for developers needing precise history modifications. This advancement enhances repository management efficiency and flexibility for the tech industry and consumers alike.

Key Takeaways

git filter-repo is a versatile tool for rewriting history, which includes capabilities I have not found anywhere else. It roughly falls into the same space of tool as git filter-branch but without the capitulation-inducing poor performance, with far more capabilities, and with a design that scales usability-wise beyond trivial rewriting cases. git filter-repo is now recommended by the git project instead of git filter-branch.

While most users will probably just use filter-repo as a simple command line tool (and likely only use a few of its flags), at its core filter-repo contains a library for creating history rewriting tools. As such, users with specialized needs can leverage it to quickly create entirely new history rewriting tools.

Table of Contents

Prerequisites

filter-repo requires:

git >= 2.36.0

python3 >= 3.6

How do I install it?

While the git-filter-repo repository has many files, the main logic is all contained in a single-file python script named git-filter-repo , which was done to make installation for basic use on many systems trivial: just place that one file into your $PATH.

See INSTALL.md for things beyond basic usage or special cases. The more involved instructions are only needed if one of the following apply:

... continue reading