Git Filter Repo Cheatsheet

· 116 words · 1 minute read

git filter-repo is a versatile tool for rewriting Git history.

Replace a sensitive string in all files:

git filter-repo --replace-text <(echo 'find==>replacement')

Extract a single folder, keeping history:

git filter-repo --path path/to/folder

Remove a single folder, keeping history:

git filter-repo --path path/to/folder --invert-paths

Move everything from sub-folder one level up:

git filter-repo --path-rename path/to/folder/:

To remove large files or passwords from Git history, check bfg .

More information: https://github.com/newren/git-filter-repo .

I hope this post helps you. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .

Share:
waffarx cash back