Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-prune(1) |
| 2 | ============ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 4ec0671 | 2007-06-09 20:39:33 | [diff] [blame] | 6 | git-prune - Prune all unreachable objects from the object database |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 12 | 'git prune' [-n] [-v] [--expire <expire>] [--] [<head>...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 17 | NOTE: In most cases, users should run 'git gc', which calls |
| 18 | 'git prune'. See the section "NOTES", below. |
Junio C Hamano | 7d575a5 | 2008-04-30 08:45:27 | [diff] [blame] | 19 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 20 | This runs 'git fsck --unreachable' using all the refs |
Junio C Hamano | 4fdccb2 | 2010-02-19 09:58:14 | [diff] [blame] | 21 | available in `refs/`, optionally with additional set of |
Junio C Hamano | 229a72f | 2008-05-16 00:47:56 | [diff] [blame] | 22 | objects specified on the command line, and prunes all unpacked |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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 |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 26 | running 'git prune-packed'. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 27 | |
Junio C Hamano | 229a72f | 2008-05-16 00:47:56 | [diff] [blame] | 28 | Note that unreachable, packed objects will remain. If this is |
| 29 | not desired, see linkgit:git-repack[1]. |
| 30 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 31 | OPTIONS |
| 32 | ------- |
| 33 | |
| 34 | -n:: |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 35 | --dry-run:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 36 | Do not remove anything; just report what it would |
| 37 | remove. |
| 38 | |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 39 | -v:: |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 40 | --verbose:: |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 41 | Report all removed objects. |
| 42 | |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 43 | \--:: |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 44 | Do not interpret any more arguments as options. |
| 45 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 46 | --expire <time>:: |
Junio C Hamano | 0c99970 | 2007-12-03 09:57:55 | [diff] [blame] | 47 | Only expire loose objects older than <time>. |
| 48 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 49 | <head>...:: |
| 50 | In addition to objects |
| 51 | reachable from any of our references, keep objects |
| 52 | reachable from listed <head>s. |
| 53 | |
| 54 | EXAMPLE |
| 55 | ------- |
| 56 | |
| 57 | To prune objects not used by your repository nor another that |
| 58 | borrows from your repository via its |
| 59 | `.git/objects/info/alternates`: |
| 60 | |
| 61 | ------------ |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 62 | $ git prune $(cd ../another && $(git rev-parse --all)) |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 63 | ------------ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 64 | |
Junio C Hamano | 7d575a5 | 2008-04-30 08:45:27 | [diff] [blame] | 65 | Notes |
| 66 | ----- |
| 67 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 68 | In most cases, users will not need to call 'git prune' directly, but |
| 69 | should instead call 'git gc', which handles pruning along with |
Junio C Hamano | 7d575a5 | 2008-04-30 08:45:27 | [diff] [blame] | 70 | many other housekeeping tasks. |
| 71 | |
| 72 | For a description of which objects are considered for pruning, see |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 73 | 'git fsck''s --unreachable option. |
Junio C Hamano | 7d575a5 | 2008-04-30 08:45:27 | [diff] [blame] | 74 | |
Junio C Hamano | 9049d91 | 2008-05-29 02:09:50 | [diff] [blame] | 75 | SEE ALSO |
Junio C Hamano | 7d575a5 | 2008-04-30 08:45:27 | [diff] [blame] | 76 | -------- |
| 77 | |
| 78 | linkgit:git-fsck[1], |
| 79 | linkgit:git-gc[1], |
| 80 | linkgit:git-reflog[1] |
| 81 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 82 | GIT |
| 83 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 84 | Part of the linkgit:git[1] suite |