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

`git prune` doc or implementation defect, or user misunderstanding

From
Matt McClure <matthewlmcclure@gmail.com>
Date
May 8, 2013, 14:19 UTC
Message-ID
<CAJELnLFpOT=V4f-pthDHkGqVWR7zSS=QYgMz35LWTUB9KvKNUQ@mail.gmail.com>
In-Reply-To
<CAJELnLF_oFcoqhRmzWwFne=8D5kwt8izk5fCDqmxPrROnOxh8g@mail.gmail.com>
The `git prune` documentation says:
       This runs git fsck --unreachable using all the refs
       available in refs/, optionally with additional set of
       objects specified on the command line, and prunes all
       unpacked objects unreachable from any of these head
       objects from the object database. In addition, it prunes
       the unpacked objects that are also found in packs by
       running git prune-packed.
       Note that unreachable, packed objects will remain. If this
       is not desired, see git-repack(1).

My interpretation of that is that `git prune` will not prune packed objects by default. The following behavior seems inconsistent with that interpretation.

[git@438587-beefcake01 panama.git]$ git prune -n | wc -l 9210 [git@438587-beefcake01 panama.git]$ git fsck --unreachable | wc -l 9468 [git@438587-beefcake01 panama.git]$ git gc --no-prune Counting objects: 531223, done. Delta compression using up to 24 threads. Compressing objects: 100% (109848/109848), done. Writing objects: 100% (531223/531223), done. Total 531223 (delta 405288), reused 530894 (delta 404961) [git@438587-beefcake01 panama.git]$ git prune -n | wc -l 9468 [git@438587-beefcake01 panama.git]$ git fsck --unreachable | wc -l 9468

It looks like `git prune -n` is telling me that it would prune the objects that I just packed. What am I misunderstanding?

-- Matt McClure http://matthewlmcclure.com http://www.mapmyfitness.com/profile/matthewlmcclure

Next: Johannes Sixt
Message 1 of 3 in “`git prune` doc or implementation defect, or user misunderstanding”
  1. Matt McClureMay 8, 2013
  2. Johannes SixtMay 8, 2013
  3. Matt McClureMay 8, 2013

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.