blob: 7a493c80f776092265abd4fb2575639e683bcf5c [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-prune(1)
2============
3
4NAME
5----
Junio C Hamano4ec06712007-06-09 20:39:336git-prune - Prune all unreachable objects from the object database
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamano1aa40d22010-01-21 17:46:4312'git prune' [-n] [-v] [--expire <expire>] [--] [<head>...]
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
16
Junio C Hamano1aa40d22010-01-21 17:46:4317NOTE: In most cases, users should run 'git gc', which calls
18'git prune'. See the section "NOTES", below.
Junio C Hamano7d575a52008-04-30 08:45:2719
Junio C Hamano1aa40d22010-01-21 17:46:4320This runs 'git fsck --unreachable' using all the refs
Junio C Hamano4fdccb22010-02-19 09:58:1421available in `refs/`, optionally with additional set of
Junio C Hamano229a72f2008-05-16 00:47:5622objects specified on the command line, and prunes all unpacked
Junio C Hamano1a4e8412005-12-27 08:17:2323objects unreachable from any of these head objects from the object database.
24In addition, it
25prunes the unpacked objects that are also found in packs by
Junio C Hamano1aa40d22010-01-21 17:46:4326running 'git prune-packed'.
Junio C Hamano61525f92014-01-17 22:46:4927It also removes entries from .git/shallow that are not reachable by
28any ref.
Junio C Hamano1a4e8412005-12-27 08:17:2329
Junio C Hamano229a72f2008-05-16 00:47:5630Note that unreachable, packed objects will remain. If this is
31not desired, see linkgit:git-repack[1].
32
Junio C Hamano1a4e8412005-12-27 08:17:2333OPTIONS
34-------
35
36-n::
Junio C Hamanoe85e36f2010-08-10 05:30:1437--dry-run::
Junio C Hamano1a4e8412005-12-27 08:17:2338Do not remove anything; just report what it would
39remove.
40
Junio C Hamanoa476efa2008-10-10 15:31:4241-v::
Junio C Hamanoe85e36f2010-08-10 05:30:1442--verbose::
Junio C Hamanoa476efa2008-10-10 15:31:4243Report all removed objects.
44
Junio C Hamano1bb569e2006-05-05 23:14:2545\--::
Junio C Hamano1a4e8412005-12-27 08:17:2346Do not interpret any more arguments as options.
47
Junio C Hamanoeb415992008-06-08 22:49:4748--expire <time>::
Junio C Hamano0c999702007-12-03 09:57:5549Only expire loose objects older than <time>.
50
Junio C Hamano1a4e8412005-12-27 08:17:2351<head>...::
52In addition to objects
53reachable from any of our references, keep objects
54reachable from listed <head>s.
55
56EXAMPLE
57-------
58
Junio C Hamanod75148a2014-04-08 19:48:3859To prune objects not used by your repository or another that
Junio C Hamano1a4e8412005-12-27 08:17:2360borrows from your repository via its
61`.git/objects/info/alternates`:
62
63------------
Junio C Hamanod7fccbf2013-07-25 03:24:5764$ git prune $(cd ../another && git rev-parse --all)
Junio C Hamano1a4e8412005-12-27 08:17:2365------------
Junio C Hamano1a4e8412005-12-27 08:17:2366
Junio C Hamano7d575a52008-04-30 08:45:2767Notes
68-----
69
Junio C Hamano1aa40d22010-01-21 17:46:4370In most cases, users will not need to call 'git prune' directly, but
71should instead call 'git gc', which handles pruning along with
Junio C Hamano7d575a52008-04-30 08:45:2772many other housekeeping tasks.
73
74For a description of which objects are considered for pruning, see
Junio C Hamano1aa40d22010-01-21 17:46:4375'git fsck''s --unreachable option.
Junio C Hamano7d575a52008-04-30 08:45:2776
Junio C Hamano9049d912008-05-29 02:09:5077SEE ALSO
Junio C Hamano7d575a52008-04-30 08:45:2778--------
79
80linkgit:git-fsck[1],
81linkgit:git-gc[1],
82linkgit:git-reflog[1]
83
Junio C Hamano1a4e8412005-12-27 08:17:2384GIT
85---
Junio C Hamanof7c042d2008-06-06 22:50:5386Part of the linkgit:git[1] suite