HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

git filter-repo — A versatile tool for rewriting Git history. See also: `bfg`. More information: <https://github.com/n

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandforclitoolrewritingversatilegit filter-repogit

Problem

How to use the git filter-repo command: A versatile tool for rewriting Git history. See also: bfg. More information: <https://github.com/newren/git-filter-repo>.

Solution

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}}/:

Code Snippets

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}}/:

Context

tldr-pages: common/git filter-repo

Revisions (0)

No revisions yet.