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:11 UTC
Message-ID
<hrnl7o$nnf$1@dough.gmane.org>
In-Reply-To
<m3ocgwfvw2.fsf@localhost.localdomain>
Hi Jakub,
Jakub Narebski wrote:
Show 7 quoted lines
> Gelonida <gelonida@gmail.com> writes:
> 
>> We have a git repository, whose size we want to reduce drastically due
>> to frequent clone operations and a slow network connection.
>  
> Why frequent *clone* operations, instead of using "git fetch" or
> equivalent ("git pull" which is fetch+merge, or "git remote update")?

The clone is part of the deployment process and would IIRC be equivalent to a 'svn export' Almost certainly one can also improve this, but this should probably discussed in another thread.

The sequence on some remote hosts is.
- git clone tag dirname
- rm -rf dirname/.git
- tar cvfz dirname.tgz dirname
> 
> If network is slow, you can do what others did in similar situations:
> use hook to allow only not to large fetches (to prevent cloning)
> directly on server, and provide bundle (see git-bundle(1)) to "seed"
> the clone; it can be on dumb server (served resumably), and can be
> also served by BitTorrent or equivalent.

The server NW is fast, but the clients' network connection not therefore no need to offload the server.

Show 17 quoted lines
>  
>> The idea is following:
>>
>> * archive the git repository just in case we really have to go back in
>> history.
>>
>>
>> create a new git repository, which shall only contain last month's activity.
>>
>> all changes before should be squashed together.
>> It would be no problem if the very first commit remains unmodified.
> 
> 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.

This sounds exactly as what I'd like to do. I used "git gui" => "Visualize All Branch History" y to choose a nice single cutoff point. I just didn't know how to apply the cut.

So the command to look for is git-filter-branch, right ? I'll read the doc.

> 
> You can later use grafts or refs/replaces/ mechanism to join "current"
> history with historical repository.

Probably we wont need this, but this sounds rather interesting and is good to know.

Thanks a lot
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 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.