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

Re: how to delete the entire history before a certain commit

From
GGelonida <gelonida@gmail.com>
Date
May 3, 2010, 23:58 UTC
Message-ID
<4BDF631C.8010800@gmail.com>
In-Reply-To
<m3k4rkft7k.fsf@localhost.localdomain>
Hi Jakub,
Jakub Narebski wrote:
Show 5 quoted lines
> Gelonida <gelonida@gmail.com> writes:
>> Jakub Narebski wrote:
>>> Gelonida <gelonida@gmail.com> writes:
>>>
>>>> We have a git repository, whose size we want to reduce drastically 
Show 5 quoted lines
>>> If you want to simply _remove_ history before specified commit,
>>> instead of squashing it, the best solution would be to use grafts to
>>> cauterize (cut) history, check using [graphical] history viewer that
>>> you cut it correctly, and then then use git-filter-branch to make this
>>> cut permanent.
Show 18 quoted lines
> You can read about grafts in git-filter-branch(1) manpage, in
> gitrepository-layout(5) git repository layout description, and in
> gitglossary(7) a git glossary.
> 
> In short, each line in .git/info/grafts consist of sha1 id of object,
> followed by space-separated list of its effective (grafted) parents.
> So to cut history e.g. after commit a3eb250f996bf5e, you need to put
> line containing only this SHA-1 in .git/info/grafts file, e.g.:
> 
>   $ git rev-parse --verify a3eb250f996bf5e >> .git/info/grafts
>  
>> So the command to look for is git-filter-branch, right ?
>> I'll read the doc.
> 
> 
> As you would see in git-filter-branch(1) documentation, simple
> 
>   $ git filter-branch --all

The command git filter-branch --all did not work for me. it just fdisplays the help text.

however without '--all' git filter-branch

seems to have worked.
Thanks a lot :-)
Previous: Jakub Narebski
Message 5 of 5 in “how to delete the entire history before a certain commit”
  1. GelonidaMay 3, 2010
  2. Jakub NarebskiMay 3, 2010
  3. GelonidaMay 3, 2010
  4. Jakub NarebskiMay 3, 2010
  5. GelonidaMay 3, 2010

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.