Re: How to delete files and directories from git commit history?
- Date: Tue, 12 Jun 2018 13:36:14 -0700
- From: Junio C Hamano <gitster@xxxxxxxxx>
- Subject: Re: How to delete files and directories from git commit history?
Steve Litt <slitt@xxxxxxxxxxxxxxxxxxx> writes:
> But then I view all filenames from that directory that have ever been
> in the project, as follows:
> git cat-file --buffer --batch-all-objects \
> --batch-check='%(objecttype) %(objectname)' \
> | grep ^c | cut -d " " -f 2 \
> | xargs -n 1 git ls-tree -r | sort | uniq \
> | grep propdir
> The preceding command lists directory docs/propdir and all the files
> it's ever contained....
In which repository did you run this? As cat-file's documentation
clearly states, --batch-all-objects does not *care* about the
reachability, so even after rewriting the history using
filter-branch, as long as you have the original objects before your
history rewrite in the repository, it _will_ see those trees with
propdir, even if they are now unreachable thanks to your
filter-branch. If you are doing the above in the original (or in a
local clone), try running "git repack -a -d && git prune
--expire=now" after filter-branch.