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] |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 12 | 'git prune' [-n] [-v] [--expire <expire>] [--] [<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'. |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 27 | |
Chris Frey | 58949bb | 2008-05-14 19:22:18 -0400 | [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 | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 31 | OPTIONS |
| 32 | ------- |
| 33 | |
| 34 | -n:: |
René Scharfe | 24aea03 | 2010-08-06 22:28:05 +0200 | [diff] [blame] | 35 | --dry-run:: |
Junio C Hamano | f85a419 | 2005-08-29 17:21:06 -0700 | [diff] [blame] | 36 | Do not remove anything; just report what it would |
| 37 | remove. |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 38 | |
Michael J Gruber | b35ddf4 | 2008-09-29 18:49:52 +0200 | [diff] [blame] | 39 | -v:: |
René Scharfe | 24aea03 | 2010-08-06 22:28:05 +0200 | [diff] [blame] | 40 | --verbose:: |
Michael J Gruber | b35ddf4 | 2008-09-29 18:49:52 +0200 | [diff] [blame] | 41 | Report all removed objects. |
| 42 | |
sean | e994004 | 2006-05-05 15:05:24 -0400 | [diff] [blame] | 43 | \--:: |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 44 | Do not interpret any more arguments as options. |
| 45 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 46 | --expire <time>:: |
Johannes Schindelin | f01913e | 2007-11-29 20:59:55 +0000 | [diff] [blame] | 47 | Only expire loose objects older than <time>. |
| 48 | |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 49 | <head>...:: |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 50 | In addition to objects |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 51 | reachable from any of our references, keep objects |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 52 | reachable from listed <head>s. |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 53 | |
| 54 | EXAMPLE |
| 55 | ------- |
| 56 | |
Junio C Hamano | 2b86976 | 2005-12-08 23:18:41 -0800 | [diff] [blame] | 57 | To prune objects not used by your repository nor another that |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 58 | borrows from your repository via its |
| 59 | `.git/objects/info/alternates`: |
| 60 | |
| 61 | ------------ |
Jonathan Nieder | b1889c3 | 2008-06-30 01:09:04 -0500 | [diff] [blame] | 62 | $ git prune $(cd ../another && $(git rev-parse --all)) |
Junio C Hamano | c82365d | 2005-12-08 16:30:24 -0800 | [diff] [blame] | 63 | ------------ |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 64 | |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 65 | Notes |
| 66 | ----- |
| 67 | |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [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 |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 70 | many other housekeeping tasks. |
| 71 | |
| 72 | For a description of which objects are considered for pruning, see |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 73 | 'git fsck''s --unreachable option. |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 74 | |
Junio C Hamano | 56ae8df | 2008-05-28 16:55:27 -0700 | [diff] [blame] | 75 | SEE ALSO |
Jeff King | 8d308b3 | 2008-04-29 16:45:14 -0400 | [diff] [blame] | 76 | -------- |
| 77 | |
| 78 | linkgit:git-fsck[1], |
| 79 | linkgit:git-gc[1], |
| 80 | linkgit:git-reflog[1] |
| 81 | |
David Greaves | 2cf565c | 2005-05-10 22:32:30 +0100 | [diff] [blame] | 82 | GIT |
| 83 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 84 | Part of the linkgit:git[1] suite |