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
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 12, 2018, 20:33 UTC
Message-ID
<CAPig+cSTyz7uG7RJFYKZEcS=+-i_mJh6abT7+ePiNm=D8s3RtQ@mail.gmail.com>
In-Reply-To
<CAP8UFD38pLbAZce0bS=G62SCeTKvjn2Eao26Dkm5p72CAx3pYw@mail.gmail.com>

On Tue, Jun 12, 2018 at 4:26 PM, Christian Couder <christian.couder@gmail.com> wrote:

Show 15 quoted lines
> On Tue, Jun 12, 2018 at 9:44 PM, Steve Litt <slitt@troubleshooters.com> wrote:
>
>> My project (call it myproject) had a directory (call it docs/propdir)
>> that was unnecessary for the project, and I've decided I don't want to
>> offer the files in that directory as free software. So I need to delete
>> docs/propdir from all commits in the repository. I did the following,
>> while in my working repository's myproject directory:
>>
>> git filter-branch --tree-filter 'rm -rf docs/propdir' HEAD
>
>> What command do I do to remove all mention of doc/propdir and its
>> files from my git history?
>
> Did you check the "CHECKLIST FOR SHRINKING A REPOSITORY" section of
> the filter-branch man/help page?

Also see BFG Repo Cleaner for an alternative. https://rtyley.github.io/bfg-repo-cleaner/

Previous: Christian CouderNext: Junio C Hamano
Message 4 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.