git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to delete files and directories from git commit history?

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 12, 2018, 20:36 UTC
Message-ID
<xmqqk1r391z5.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180612154413.3df64441@mydesk.domain.cxm>
Steve Litt <slitt@troubleshooters.com> writes:
Show 11 quoted lines
> 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.

Previous: Eric Sunshine
Message 5 of 5 in “How to delete files and directories from git commit history?”
  1. Steve LittJun 12, 2018
  2. Eckhard MaaßJun 12, 2018
  3. Christian CouderJun 12, 2018
  4. Eric SunshineJun 12, 2018
  5. Junio C HamanoJun 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.