blob: 80d01b05710e250a5f1d548fca3fba54d50e0f29 [file] [log] [blame]
Junio C Hamano215a7ad2005-09-07 17:26:23 -07001git-prune(1)
2============
David Greaves2cf565c2005-05-10 22:32:30 +01003
4NAME
5----
william pursell29cf5e12007-06-09 16:44:12 +01006git-prune - Prune all unreachable objects from the object database
David Greaves2cf565c2005-05-10 22:32:30 +01007
8
9SYNOPSIS
10--------
Martin von Zweigbergk7791a1d2011-07-01 22:38:26 -040011[verse]
Thomas Rast0b444cd2010-01-10 00:33:00 +010012'git prune' [-n] [-v] [--expire <expire>] [--] [<head>...]
David Greaves2cf565c2005-05-10 22:32:30 +010013
14DESCRIPTION
15-----------
Junio C Hamanof85a4192005-08-29 17:21:06 -070016
Thomas Rast0b444cd2010-01-10 00:33:00 +010017NOTE: In most cases, users should run 'git gc', which calls
18'git prune'. See the section "NOTES", below.
Jeff King8d308b32008-04-29 16:45:14 -040019
Thomas Rast0b444cd2010-01-10 00:33:00 +010020This runs 'git fsck --unreachable' using all the refs
Jeff Kingcc1b8d82010-02-17 20:16:20 -050021available in `refs/`, optionally with additional set of
Chris Frey58949bb2008-05-14 19:22:18 -040022objects specified on the command line, and prunes all unpacked
Junio C Hamano2b869762005-12-08 23:18:41 -080023objects unreachable from any of these head objects from the object database.
24In addition, it
Junio C Hamanof85a4192005-08-29 17:21:06 -070025prunes the unpacked objects that are also found in packs by
Thomas Rast0b444cd2010-01-10 00:33:00 +010026running 'git prune-packed'.
Junio C Hamanof85a4192005-08-29 17:21:06 -070027
Chris Frey58949bb2008-05-14 19:22:18 -040028Note that unreachable, packed objects will remain. If this is
29not desired, see linkgit:git-repack[1].
30
Junio C Hamanof85a4192005-08-29 17:21:06 -070031OPTIONS
32-------
33
34-n::
René Scharfe24aea032010-08-06 22:28:05 +020035--dry-run::
Junio C Hamanof85a4192005-08-29 17:21:06 -070036 Do not remove anything; just report what it would
37 remove.
David Greaves2cf565c2005-05-10 22:32:30 +010038
Michael J Gruberb35ddf42008-09-29 18:49:52 +020039-v::
René Scharfe24aea032010-08-06 22:28:05 +020040--verbose::
Michael J Gruberb35ddf42008-09-29 18:49:52 +020041 Report all removed objects.
42
seane9940042006-05-05 15:05:24 -040043\--::
Junio C Hamanoc82365d2005-12-08 16:30:24 -080044 Do not interpret any more arguments as options.
45
Stephan Beyer32402402008-06-08 03:36:09 +020046--expire <time>::
Johannes Schindelinf01913e2007-11-29 20:59:55 +000047 Only expire loose objects older than <time>.
48
Junio C Hamanoc82365d2005-12-08 16:30:24 -080049<head>...::
Junio C Hamano2b869762005-12-08 23:18:41 -080050 In addition to objects
Junio C Hamanoc82365d2005-12-08 16:30:24 -080051 reachable from any of our references, keep objects
Junio C Hamano2b869762005-12-08 23:18:41 -080052 reachable from listed <head>s.
Junio C Hamanoc82365d2005-12-08 16:30:24 -080053
54EXAMPLE
55-------
56
Junio C Hamano2b869762005-12-08 23:18:41 -080057To prune objects not used by your repository nor another that
Junio C Hamanoc82365d2005-12-08 16:30:24 -080058borrows from your repository via its
59`.git/objects/info/alternates`:
60
61------------
Jonathan Niederb1889c32008-06-30 01:09:04 -050062$ git prune $(cd ../another && $(git rev-parse --all))
Junio C Hamanoc82365d2005-12-08 16:30:24 -080063------------
David Greaves2cf565c2005-05-10 22:32:30 +010064
Jeff King8d308b32008-04-29 16:45:14 -040065Notes
66-----
67
Thomas Rast0b444cd2010-01-10 00:33:00 +010068In most cases, users will not need to call 'git prune' directly, but
69should instead call 'git gc', which handles pruning along with
Jeff King8d308b32008-04-29 16:45:14 -040070many other housekeeping tasks.
71
72For a description of which objects are considered for pruning, see
Thomas Rast0b444cd2010-01-10 00:33:00 +010073'git fsck''s --unreachable option.
Jeff King8d308b32008-04-29 16:45:14 -040074
Junio C Hamano56ae8df2008-05-28 16:55:27 -070075SEE ALSO
Jeff King8d308b32008-04-29 16:45:14 -040076--------
77
78linkgit:git-fsck[1],
79linkgit:git-gc[1],
80linkgit:git-reflog[1]
81
David Greaves2cf565c2005-05-10 22:32:30 +010082GIT
83---
Christian Couder9e1f0a82008-06-06 09:07:32 +020084Part of the linkgit:git[1] suite