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

Re: Cleaning the .git directory with gc

From
Shawn O. Pearce <spearce@spearce.org>
Date
Apr 24, 2008, 00:57 UTC
Message-ID
<20080424005744.GR29771@spearce.org>
In-Reply-To
<e1dab3980804231732x29d6d73cudd0568a910642639@mail.gmail.com>
David Tweed <david.tweed@gmail.com> wrote:
Show 18 quoted lines
> On Thu, Apr 24, 2008 at 1:09 AM, Russ Dill <russ.dill@gmail.com> wrote:
> > On Wed, Apr 23, 2008 at 4:13 PM, Haakon Riiser <haakon.riiser@fys.uio.no> wrote:
> >  > I've recently started using git, and while experimenting with
> >  >  git commit --amend, I noticed that git gc does not do what I
> >  >  expected.  Example:
> >
> >  Thats a lot of work without first reading the man page:
> >
> >        --prune
> [snip]
> 
> There's a relatively recent change in this area. Git keeps stuff
> that's apparently unattached for a period of, by default, 2 weeks
> (determined by gc.pruneexpire variable) after which a git gc will
> remove it. The reasoning is that even with the careful design of the
> git updating strategy there are rare times when with a concurrent
> other git process there are files in the repo that look unattached but
> will become attached as the other process completes.

Although that's certainly true, the original poster was asking about `git commit --amend`. In such a case the reflog for HEAD and the current branch are going to anchor the old commit for the reflog expire period, which is 90 days. Way longer than the 2 week aging of loose objects.

-- 
Shawn.
Previous: David TweedNext: Shawn O. Pearce
Message 4 of 6 in “Cleaning the .git directory with gc”
  1. Haakon RiiserApr 23, 2008
  2. Russ DillApr 24, 2008
  3. David TweedApr 24, 2008
  4. Shawn O. PearceApr 24, 2008
  5. Shawn O. PearceApr 24, 2008
  6. Haakon RiiserApr 24, 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.