1GIT-PRUNE(1) Git Manual GIT-PRUNE(1)
2
3
4
6 git-prune - Prune all unreachable objects from the object database
7
9 git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]
10
12 Note
13 In most cases, users should run git gc, which calls git prune. See
14 the section "NOTES", below.
15
16 This runs git fsck --unreachable using all the refs available in refs/,
17 optionally with an additional set of objects specified on the command
18 line, and prunes all unpacked objects unreachable from any of these
19 head objects from the object database. In addition, it prunes the
20 unpacked objects that are also found in packs by running git
21 prune-packed. It also removes entries from .git/shallow that are not
22 reachable by any ref.
23
24 Note that unreachable, packed objects will remain. If this is not
25 desired, see git-repack(1).
26
28 -n, --dry-run
29 Do not remove anything; just report what it would remove.
30
31 -v, --verbose
32 Report all removed objects.
33
34 --progress
35 Show progress.
36
37 --expire <time>
38 Only expire loose objects older than <time>.
39
40 --
41 Do not interpret any more arguments as options.
42
43 <head>...
44 In addition to objects reachable from any of our references, keep
45 objects reachable from listed <head>s.
46
48 To prune objects not used by your repository or another that borrows
49 from your repository via its .git/objects/info/alternates:
50
51 $ git prune $(cd ../another && git rev-parse --all)
52
54 In most cases, users will not need to call git prune directly, but
55 should instead call git gc, which handles pruning along with many other
56 housekeeping tasks.
57
58 For a description of which objects are considered for pruning, see git
59 fsck's --unreachable option.
60
62 git-fsck(1), git-gc(1), git-reflog(1)
63
65 Part of the git(1) suite
66
67
68
69Git 2.43.0 11/20/2023 GIT-PRUNE(1)