git filter-repo
A versatile tool for rewriting Git history.
See also: bfg
.
More information: https://github.com/newren/git-filter-repo.
-
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/:}}
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.