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

Re: Big repo not shrinking on repack or gc?

From
Jeff King <peff@peff.net>
Date
Jan 14, 2015, 12:49 UTC
Message-ID
<20150114124936.GC30383@peff.net>
In-Reply-To
<20150114115130.GA5677@inner.h.apk.li>
On Wed, Jan 14, 2015 at 12:51:30PM +0100, Andreas Krey wrote:
> I have a repo here that is 130G, but when I clone --mirror it, the result
> is only 25G big.  Because of the --mirror I don't think that I missed
> any refs that keep objects only in the source repo.

Perhaps some objects are mentioned by reflogs, but not by the refs? They would not be transferred as part of a clone. Try:

  git rev-list --objects --all | cut -d' ' -f1 | sort >reachable
  git rev-list --objects --reflog | cut -d' ' -f1 | sort >reflogs
  comm -13 reachable reflogs |
  git cat-file --batch-check='%(objectsize:disk)' |
  perl -lne '$total += $_; END { print $total }'

That should print the size, in bytes, that reflog-only objects are using on disk. You can use "git reflog expire --expire-unreachable=now --all" to get rid of them (and then repack).

> I already tried 'git repack -fad' and 'git gc' to shrink the original repo,

You don't need the "-f" here. Just "git repack -ad" should be enough (and the "-f" probably makes it _way_ slower).

-Peff
Previous: Andreas KreyNext: Andreas Krey
Message 2 of 11 in “Big repo not shrinking on repack or gc?”
  1. Andreas KreyJan 14, 2015
  2. Jeff KingJan 14, 2015
  3. Andreas KreyJan 14, 2015
  4. Andreas KreyJan 14, 2015
  5. Andreas KreyJan 14, 2015
  6. Junio C HamanoJan 14, 2015
  7. Bryan TurnerJan 15, 2015
  8. Andreas KreyJan 15, 2015
  9. Bryan TurnerJan 15, 2015
  10. Andreas KreyJan 15, 2015
  11. Bryan TurnerJan 15, 2015

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.