blob: 80d01b05710e250a5f1d548fca3fba54d50e0f29 [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 Hamano1a4e8412005-12-27 08:17:2327
Junio C Hamano229a72f2008-05-16 00:47:5628Note that unreachable, packed objects will remain. If this is
29not desired, see linkgit:git-repack[1].
30
Junio C Hamano1a4e8412005-12-27 08:17:2331OPTIONS
32-------
33
34-n::
Junio C Hamanoe85e36f2010-08-10 05:30:1435--dry-run::
Junio C Hamano1a4e8412005-12-27 08:17:2336Do not remove anything; just report what it would
37remove.
38
Junio C Hamanoa476efa2008-10-10 15:31:4239-v::
Junio C Hamanoe85e36f2010-08-10 05:30:1440--verbose::
Junio C Hamanoa476efa2008-10-10 15:31:4241Report all removed objects.
42
Junio C Hamano1bb569e2006-05-05 23:14:2543\--::
Junio C Hamano1a4e8412005-12-27 08:17:2344Do not interpret any more arguments as options.
45
Junio C Hamanoeb415992008-06-08 22:49:4746--expire <time>::
Junio C Hamano0c999702007-12-03 09:57:5547Only expire loose objects older than <time>.
48
Junio C Hamano1a4e8412005-12-27 08:17:2349<head>...::
50In addition to objects
51reachable from any of our references, keep objects
52reachable from listed <head>s.
53
54EXAMPLE
55-------
56
57To prune objects not used by your repository nor another that
58borrows from your repository via its
59`.git/objects/info/alternates`:
60
61------------
Junio C Hamanofce7c7e2008-07-02 03:06:3862$ git prune $(cd ../another && $(git rev-parse --all))
Junio C Hamano1a4e8412005-12-27 08:17:2363------------
Junio C Hamano1a4e8412005-12-27 08:17:2364
Junio C Hamano7d575a52008-04-30 08:45:2765Notes
66-----
67
Junio C Hamano1aa40d22010-01-21 17:46:4368In most cases, users will not need to call 'git prune' directly, but
69should instead call 'git gc', which handles pruning along with
Junio C Hamano7d575a52008-04-30 08:45:2770many other housekeeping tasks.
71
72For a description of which objects are considered for pruning, see
Junio C Hamano1aa40d22010-01-21 17:46:4373'git fsck''s --unreachable option.
Junio C Hamano7d575a52008-04-30 08:45:2774
Junio C Hamano9049d912008-05-29 02:09:5075SEE ALSO
Junio C Hamano7d575a52008-04-30 08:45:2776--------
77
78linkgit:git-fsck[1],
79linkgit:git-gc[1],
80linkgit:git-reflog[1]
81
Junio C Hamano1a4e8412005-12-27 08:17:2382GIT
83---
Junio C Hamanof7c042d2008-06-06 22:50:5384Part of the linkgit:git[1] suite