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

Re: Using git for file archival/backup purposes - deletion strategy

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Dec 27, 2007, 09:18 UTC
Message-ID
<47736DE5.40509@viscovery.net>
In-Reply-To
<46a038f90712261443t6aa0cd76u46d8ae88fc7c1eba@mail.gmail.com>
Martin Langhoff schrieb:
Show 10 quoted lines
> What I am not 100% clear on is the "old history" deletion strategy.
> The history will be *strictly* linear, so my intention is to keep the
> last N commits, by overriding the parent of the Nth commit that git
> log lists with a "shallow" entry in $GIT_DIR/shallow as documented in
> Documentation/technical/shallow.txt , and call gc after that.
> 
> Is that the correct way to "forget" old history? Searching high and
> low in the list, I fail to find a definitive answer. Shallow and
> grafts entries are discussed as ways of doing this, but I can't find a
> "correct" way of doing this.
I'm doing something like this. Basically:
   git rev-parse "HEAD~$N" > .git/info/grafts
   git filter-branch -f HEAD

If you omit filter-branch, then a repack -a -d will corrupt the repository (I think) unless you keep the grafts file with it and in all its clones forever.

-- Hannes
Previous: Martin LanghoffNext: Charles Bailey
Message 2 of 4 in “Using git for file archival/backup purposes - deletion strategy”
  1. Martin LanghoffDec 26, 2007
  2. Johannes SixtDec 27, 2007
  3. Charles BaileyDec 27, 2007
  4. Martin LanghoffDec 27, 2007

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.