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

Re: "git gc" doesn't seem to remove loose objects any more

From
MMMikael Magnusson <mikachu@gmail.com>
Date
Dec 15, 2008, 13:38 UTC
Message-ID
<237967ef0812150538n671c22b8gaf7a7b5dcaf68433@mail.gmail.com>
In-Reply-To
<808wqhzjl9.fsf@tiny.isode.net>
2008/12/15 Bruce Stephens <bruce.stephens@isode.com>:
Show 31 quoted lines
> I couldn't see a test for this, but perhaps I'm just missing it?
>
>    brs% git count-objects
>    161 objects, 1552 kilobytes
>    brs% git gc
>    Counting objects: 80621, done.
>    Compressing objects: 100% (22372/22372), done.
>    Writing objects: 100% (80621/80621), done.
>    Total 80621 (delta 57160), reused 80305 (delta 56884)
>    brs% git count-objects
>    207 objects, 2048 kilobytes
>
>
> And I see lots of directories under .git/objects which confirms
> things.
>
> I don't think I've changed any relevant configuration.
>
> This is with 8befc50c49e8a271fd3cd7fb34258fe88d1dfcad (also whatever
> version I used before, erm, probably
> de0db422782ddaf7754ac5b03fdc6dc5de1a9ae4), and possibly earlier
> versions---I've just started noticing now that the number of loose
> objects has started causing git gui to complain.
>
> (Hmm, I note that git gui reports a larger number of loose objects
> than git count-objects.  Ah, OK, it really is just an approximation,
> so no surprise.)
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

IIRC git gc only removes loose objects older than two weeks, if you really want to remove them now, run git prune. But make sure no other git process can be active when you run it, or it could possibly step on something.

-- 
Mikael Magnusson
Previous: Bruce StephensNext: Bruce Stephens
Message 2 of 12 in “"git gc" doesn't seem to remove loose objects any more”
  1. Bruce StephensDec 15, 2008
  2. Mikael MagnussonDec 15, 2008
  3. Bruce StephensDec 15, 2008
  4. Björn SteinbrinkDec 15, 2008
  5. Theodore TsoDec 15, 2008
  6. Mark BrownDec 15, 2008
  7. Johan HerlandDec 15, 2008
  8. Mikael MagnussonDec 15, 2008
  9. Jakub NarebskiDec 15, 2008
  10. Theodore TsoDec 15, 2008
  11. Brandon CaseyDec 15, 2008
  12. objects to be pruned immediately don't have to be loosenedNicolas Pitre, Dec 15, 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.