. , git filter-branch --tree-filter, . : script, ; . .
-, : . , , , , " ". Git, . , . (, , Git . - .)
, , / , , , , , 1 git filter-branch. filter-branch , , . , , ; 100 . , 100 . , (10 000 000 000 ) . .
, . --index-filter, , , . - --tree-filter, . , , , script , , , ( git update-index ).
1 , . ( , , : , - , , , ; , ).
--tree-filter
git filter-branch --tree-filter, , , , , , . .git , git filter-branch ( .git, -d Git, , , ).
Git . , Git . , , . , , . , , . , , .
, .gitignore , ( .gitignore , , , -). , , - , rm -f known/path/to/file.ext. , . , , .
, :
rm -f $(cat /tmp/files-to-remove)
( , xargs ... | rm -f, , , xargs; -z , \0 ).
Git . "" , .
, /tmp/files-to-remove , xargs -0. :
xargs -0 /tmp/files-to-remove | git rm --cached -f --ignore-unmatch
rm -f , Git, , . ( -q git rm --cached, .)
.gitignore
script --tree-filter , :
git filter-branch --tree-filter 'git clean -f -X' -- --all
(< <229 > ):
-git rebase --onto temp master
+git rebase --onto temp temp master
, , , git clean -f -X , . , , .
, . : git clean , : , . git clean -f -X :
-git filter-branch --tree-filter 'git clean -f -X' -- --all
+git filter-branch --tree-filter 'git rm --cached -qrf . && git add . && git clean -fqX' -- --all
( "" ).
.gitignore, , .gitignore, ( -). :
mkdir /tmp/ignores-to-add
cp .gitignore /tmp/ignores-to-add
mkdir /tmp/ignores-to-add/main
cp main/.gitignore /tmp/ignores-to-add
( script, .gitignore, , ). --tree-filter :
cp -R /tmp/ignores-to-add . &&
git rm --cached -qrf . &&
git add . &&
git clean -fqX
cp -R ( - git add ., ), .gitignore. , filter-branch.
. ( - rm $GIT_INDEX_FILE, , .)
., .. . .gitignore , .
git clean -qfX , , filter-branch .