Structure of Git repo foo in master branch
foo/refs/a.txt
foo/bar/refs/b.txt
In other branches refs/
might be in lots of other places
To remove all instances of the directory refs (and their content) from Git (history) Environment: Windows 7 using Git Bash
find . -name refs -depth -exec rm -rf {} \;
Success, all refs/
and their content are removed (If I don't use -depth
, find will report an error that the dirs don't exists even though they were removed correctly).
git filter-branch --index-filter \
'find . -name refs -depth -exec git rm -rf --cached --ignore-unmatch {} \;' \
--prune-empty --tag-name-filter cat -- --all
As can be seen in the picture (think of temp/a
as temp/foo
) the command runs through and rewrites all commits but no refs/
are removed so somehow the output of the find is not returned to filter-branch --index-filter
as expected.
Similar things seem to work for others.
What am I missing?
PS. Yes I've read hundreds of posts, articles etc for hours and hours about this but it doesn't work for me anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With