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