GIT-PRUNE(1)
π GIT-PRUNE(1) β like, the git-prune page from the Git Manual, bestie
okay so picture this: you're deep in the Git Manual, section GIT-PRUNE(1), and you need to know how to yeet unreachable objects out of the object database. that's the whole gig. let's get into it π
β¨ NAME β¨
git-prune β prune all unreachable objects from the object database. yes, it's literally in the name, she's not subtle πβοΈ
π¦ SYNOPSIS π¦
git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]
πΈ DESCRIPTION πΈ
π Note: in most cases, users should rungit gc, which callsgit prune. see the section "NOTES", below. (like, seriously, go look. it's right there. i'm not joking.)
so what does this actually do? it runs git fsck --unreachable using all the refs available in refs/, optionally with an additional set of objects specified on the command line, and then prunes all unpacked objects unreachable from any of these head objects from the object database. iconique behaviour honestly β¨
on top of that, it prunes the unpacked objects that are also found in packs by running git prune-packed. she's thorough. she does the work. and it also removes entries from .git/shallow that are not reachable by any ref. slay cleanup crew π§Ή
β οΈ heads up, bestie: unreachable, packed objects will remain. if this is not desired, see git-repack(1). don't come for me, i'm just the messenger π
π OPTIONS π
-n,--dry-runβ do not remove anything; just report what it would remove. it's giving window shopping ποΈ-v,--verboseβ report all removed objects. she's a talker and we love her π£οΈ--progressβ show progress. so you can watch the little bar do its thing π«Ά--expire <time>β only expire loose objects older than<time>. ageism but make it garbage collection β³--β do not interpret any more arguments as options. the classic "we're done with flags now" boundary line π§<head>...β in addition to objects reachable from any of our references, keep objects reachable from listed<head>s. protect them, they're main characters π
π EXAMPLES π
to prune objects not used by your repository or another that borrows from your repository via its .git/objects/info/alternates:
$ git prune $(cd ../another && git rev-parse --all)
copy it exactly, bestie, every character. no cap π―
π₯ NOTES π₯
in most cases, users will not need to call git prune directly, but should instead call git gc, which handles pruning along with many other housekeeping tasks. she's the whole package. the moment. the icon π
for a description of which objects are considered for pruning, see git fsck's --unreachable option. iykyk π«
β SEE ALSO β
π§ GIT π§
part of the git(1) suite. royalty, obviously ππ
k that's the whole page, bestie π this glorious little manual is brought to you by Git 2.56.0, dated 2026-09-27 β and that's the vibe check, signed off with love, GIT-PRUNE(1) out πβ¨
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms