Junio C Hamano | 215a7ad | 2005-09-07 17:26:23 -0700 | [diff] [blame] | 1 | git-prune(1) |
| 2 | ============ |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
william pursell | 29cf5e1 | 2007-06-09 16:44:12 +0100 | [diff] [blame] | 6 | git-prune - Prune all unreachable objects from the object database |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Martin von Zweigbergk | 7791a1d | 2011-07-01 22:38:26 -0400 | [diff] [blame] | 11 | [verse] |
Robert P. J. Day | 1a1fc2d | 2017-11-21 10:51:52 -0500 | [diff] [blame] | 12 | 'git prune' [-n] [-v] [--progress] [--expire <time>] [--] [<head>...] |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 16 | |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 17 | NOTE: In most cases, users should run 'git gc', which calls |
| 18 | 'git prune'. See the section "NOTES", below. |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 19 | |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 20 | This runs 'git fsck --unreachable' using all the refs |
Jeff King | cc1b8d8 | 2010-02-17 20:16:20 -0500 | [diff] [blame] | 21 | available in `refs/`, optionally with additional set of |
Chris Frey | 58949bb | 2008-05-14 19:22:18 -0400 | [diff] [blame] | 22 | objects specified on the command line, and prunes all unpacked |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 23 | objects unreachable from any of these head objects from the object database. |
| 24 | In addition, it |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 25 | prunes the unpacked objects that are also found in packs by |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 26 | running 'git prune-packed'. |
Nguyễn Thái Ngọc Duy | eab3296 | 2013-12-05 20:02:54 +0700 | [diff] [blame] | 27 | It also removes entries from .git/shallow that are not reachable by |
| 28 | any ref. |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 29 | |
Chris Frey | 58949bb | 2008-05-14 19:22:18 -0400 | [diff] [blame] | 30 | Note that unreachable, packed objects will remain. If this is |
| 31 | not desired, see linkgit:git-repack[1]. |
| 32 | |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 33 | OPTIONS |
| 34 | ------- |
| 35 | |
| 36 | -n:: |
René Scharfe | 24aea03 | 2010-08-06 22:28:05 +0200 | [diff] [blame] | 37 | --dry-run:: |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 38 | Do not remove anything; just report what it would |
| 39 | remove. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 40 | |
Michael J Gruber | b35ddf4 | 2008-09-29 18:49:52 +0200 | [diff] [blame] | 41 | -v:: |
René Scharfe | 24aea03 | 2010-08-06 22:28:05 +0200 | [diff] [blame] | 42 | --verbose:: |
Michael J Gruber | b35ddf4 | 2008-09-29 18:49:52 +0200 | [diff] [blame] | 43 | Report all removed objects. |
| 44 | |
Robert P. J. Day | 1a1fc2d | 2017-11-21 10:51:52 -0500 | [diff] [blame] | 45 | --progress:: |
| 46 | Show progress. |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 47 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 48 | --expire <time>:: |
Johannes Schindelin | f01913e | 2007-11-29 20:59:55 +0000 | [diff] [blame] | 49 | Only expire loose objects older than <time>. |
| 50 | |
Robert P. J. Day | 1a1fc2d | 2017-11-21 10:51:52 -0500 | [diff] [blame] | 51 | \--:: |
| 52 | Do not interpret any more arguments as options. |
| 53 | |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 54 | <head>...:: |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 55 | In addition to objects |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 56 | reachable from any of our references, keep objects |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 57 | reachable from listed <head>s. |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 58 | |
Nguyễn Thái Ngọc Duy | 76a8788 | 2018-04-30 17:35:33 +0200 | [diff] [blame] | 59 | EXAMPLES |
| 60 | -------- |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 61 | |
Justin Lebar | a58088a | 2014-03-31 15:11:44 -0700 | [diff] [blame] | 62 | To prune objects not used by your repository or another that |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 63 | borrows from your repository via its |
| 64 | `.git/objects/info/alternates`: |
| 65 | |
| 66 | ------------ |
Jonathon Mah | 8c3ca72 | 2013-07-18 09:53:55 -0700 | [diff] [blame] | 67 | $ git prune $(cd ../another && git rev-parse --all) |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 68 | ------------ |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 69 | |
Nguyễn Thái Ngọc Duy | 76a8788 | 2018-04-30 17:35:33 +0200 | [diff] [blame] | 70 | NOTES |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 71 | ----- |
| 72 | |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 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 |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 75 | many other housekeeping tasks. |
| 76 | |
| 77 | For a description of which objects are considered for pruning, see |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 78 | 'git fsck''s --unreachable option. |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 79 | |
Junio C Hamano | 56ae8df | 2008-05-28 16:55:27 -0700 | [diff] [blame] | 80 | SEE ALSO |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 81 | -------- |
| 82 | |
| 83 | linkgit:git-fsck[1], |
| 84 | linkgit:git-gc[1], |
| 85 | linkgit:git-reflog[1] |
| 86 | |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 87 | GIT |
| 88 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 89 | Part of the linkgit:git[1] suite |