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

Re: git gc / git repack not removing unused objects?

From
Nicolas Pitre <nico@fluxnic.net>
Date
Feb 5, 2010, 21:45 UTC
Message-ID
<alpine.LFD.2.00.1002051634380.1681@xanadu.home>
In-Reply-To
<cccedfc61002051304t6030d3f7if4bb14709ee6c918@mail.gmail.com>
On Fri, 5 Feb 2010, Jon Nelson wrote:
Show 13 quoted lines
> On Fri, Feb 5, 2010 at 2:51 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
> > On Fri, 5 Feb 2010, Jon Nelson wrote:
> >
> >> [Using git 1.6.4.2]
> >>
> >> In one repo I have (136G objects directory, fully packed) I'm having
> >> some trouble.
> >> I've run git-gc --prune=now, git repack -Adf, and so on a half-dozen
> >> times and each time I do so it gets bigger, not smaller.
> >
> > Please tell us more.
> 
> I'll tell you whatever I can -- as soon as I know what it is you want.

I want to know what you did and what results you obtained to lead you to believe that 'git-gc --prune=now' makes your repository bigger.

Show 11 quoted lines
> > You need to dig further down in history to find a commit that actually
> > references that blob/tree.  One easy method is to do:
> >
> >        git log --raw --all
> >
> > and within the pager ('less' by default) simply search for "b32c3d8".
> 
> OK. I'm piping "git log --raw --all" to a file this very moment. It'll
> take a while. However, one thing I did not mention is that there
> *should* be a 1:1 correlation between branches and commits. As in,
> every time I did a commit, the commit was on a new branch. 
Ouch.  Why?  I'm curious.
> I'll look into this, as I've fiddled with the repo a bunch of 
> different ways lately. I suspect the answer will be found in the logs.

If the blob you're looking for is not in that log, then it must be referenced by one of the reflog entries. The reflog is a log of all the commits your branches, and the HEAD pointer, ever pointed at. Those entries are kept for a certain period (3 months by default). The HEAD reflog will keep a reference of all branches you might have visited, even deleted ones. So another log:

	git log --raw -g HEAD
should ultimately give you the blob reference.
Nicolas
Previous: Jon NelsonNext: Jon Nelson
Message 4 of 10 in “git gc / git repack not removing unused objects?”
  1. Jon NelsonFeb 5, 2010
  2. Nicolas PitreFeb 5, 2010
  3. Jon NelsonFeb 5, 2010
  4. Nicolas PitreFeb 5, 2010
  5. Jon NelsonFeb 6, 2010
  6. Nicolas PitreFeb 7, 2010
  7. Jon NelsonFeb 7, 2010
  8. Jon NelsonFeb 7, 2010
  9. Nicolas PitreFeb 8, 2010
  10. Jon NelsonFeb 8, 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.