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

Re: Is there a way to control the number of revisions will be saved by git

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Dec 3, 2008, 11:22 UTC
Message-ID
<49366C03.5080506@viscovery.net>
In-Reply-To
<2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com>
Tzury Bar Yochay schrieb:
> Hello Happy Gitters,
> 
> Say I wish to save only 100 generations back (per branch).
> Is it possible to configure git so it will save only N records back.
No.
> If git cannot be configured for that, Is there a way to shrink the repository
> manually so it will contain the last N generations?
Yes:
  $ git rev-parse HEAD~$N >> .git/info/grafts
  $ git filter-branch HEAD

This assumes that your history is strictly linear and you do not have tags. It also rewrites the $N commits so that they now have different SHA1s. For this reason, don't share this repository with anyone - it leads to confusion.

-- Hannes
Previous: Tzury Bar YochayNext: Jakub Narebski
Message 2 of 9 in “Is there a way to control the number of revisions will be saved by git”
  1. Tzury Bar YochayDec 3, 2008
  2. Johannes SixtDec 3, 2008
  3. Jakub NarebskiDec 3, 2008
  4. Miklos VajnaDec 3, 2008
  5. ArafangionDec 3, 2008
  6. Jean-Luc HerrenDec 3, 2008
  7. Tzury Bar YochayDec 3, 2008
  8. Tzury Bar YochayDec 3, 2008
  9. Tzury Bar YochayDec 3, 2008

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.