: git filter-branch.
, ( 10 - 100 ). - , , , ( ). , , . , , . ( - , Git .) , , A B, , , - , A, B:
find . -name A -prune -o -name B -prune -o -print0 | xargs -0 rm
.
, , Git , , . , git rm -rf --cached --ignore-unmatch, , git update-index . Git, . Unix find.
, , git ls-files, . , , ( Python, , Perl), :
for (all files in the index)
if (file name starts with 'A/' or 'B/')
do nothing
else
add to removal list
invoke "git rm --cached" on paths in removal list
, , :
git ls-files | IFS=$'\n' while read path; do
case "$path" in A/*|B/*) continue;; esac
git rm --cached "$path"
done
( git rm --cached !), " " --index-filter.
(, , , : pipe git ls-files grep -v , pipe grep git update-index --force-remove --stdin. . )