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

git gc == git garbage-create from removed branch

From
HFHallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
Date
May 3, 2012, 18:38 UTC
Message-ID
<hbf.20120503q14w@bombur.uio.no>

After removing a branch, 'git gc' explodes all objects which were only in that branch. Git filled up my disk that way when I had cherry-picked from a big remote repo and then did git remote rm. Tested with Git 1.7.10.1 and 1.7.1.

$ git clone --bare --branch linux-overhaul-20010122 \
	git://git.savannah.gnu.org/config.git
...
Receiving objects: 100% (3263/3263), 517.15 KiB | 295 KiB/s, done.
...
$ cd config.git/
$ git tag -d `git tag`
...
$ git branch -D master
$ git gc
Counting objects: 1183, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (751/751), done.
Writing objects: 100% (1183/1183), done.
Total 1183 (delta 457), reused 1113 (delta 393)

$ find objects/?? -type f -print | wc -l 2080

$ git reflog expire --expire=now; git gc --prune=now Counting objects: 1183, done. Delta compression using up to 2 threads. Compressing objects: 100% (687/687), done. Writing objects: 100% (1183/1183), done. Total 1183 (delta 457), reused 1183 (delta 457)

$ ls objects/ info/ pack/

3263 fetched objects == 2080 loose objects before prune + HEAD's 1183 objects.

-- 
Hallvard
Next: Andreas Ericsson
Message 1 of 3 in “git gc == git garbage-create from removed branch”
  1. Hallvard Breien FurusethMay 3, 2012
  2. Andreas EricssonMay 4, 2012
  3. Hallvard Breien FurusethMay 4, 2012

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.