]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-prune.txt
clone: use git protocol for cloning shallow repo locally
[thirdparty/git.git] / Documentation / git-prune.txt
CommitLineData
215a7ad1
JH
1git-prune(1)
2============
2cf565c5
DG
3
4NAME
5----
29cf5e12 6git-prune - Prune all unreachable objects from the object database
2cf565c5
DG
7
8
9SYNOPSIS
10--------
7791a1d9 11[verse]
0b444cdb 12'git prune' [-n] [-v] [--expire <expire>] [--] [<head>...]
2cf565c5
DG
13
14DESCRIPTION
15-----------
f85a4191 16
0b444cdb
TR
17NOTE: In most cases, users should run 'git gc', which calls
18'git prune'. See the section "NOTES", below.
8d308b35 19
0b444cdb 20This runs 'git fsck --unreachable' using all the refs
cc1b8d8b 21available in `refs/`, optionally with additional set of
58949bb1 22objects specified on the command line, and prunes all unpacked
2b86976b
JH
23objects unreachable from any of these head objects from the object database.
24In addition, it
f85a4191 25prunes the unpacked objects that are also found in packs by
0b444cdb 26running 'git prune-packed'.
f85a4191 27
58949bb1
CF
28Note that unreachable, packed objects will remain. If this is
29not desired, see linkgit:git-repack[1].
30
f85a4191
JH
31OPTIONS
32-------
33
34-n::
24aea033 35--dry-run::
f85a4191
JH
36 Do not remove anything; just report what it would
37 remove.
2cf565c5 38
b35ddf41 39-v::
24aea033 40--verbose::
b35ddf41
MG
41 Report all removed objects.
42
e994004f 43\--::
c82365dc
JH
44 Do not interpret any more arguments as options.
45
3240240f 46--expire <time>::
f01913e4
JS
47 Only expire loose objects older than <time>.
48
c82365dc 49<head>...::
2b86976b 50 In addition to objects
c82365dc 51 reachable from any of our references, keep objects
2b86976b 52 reachable from listed <head>s.
c82365dc
JH
53
54EXAMPLE
55-------
56
2b86976b 57To prune objects not used by your repository nor another that
c82365dc
JH
58borrows from your repository via its
59`.git/objects/info/alternates`:
60
61------------
8c3ca726 62$ git prune $(cd ../another && git rev-parse --all)
c82365dc 63------------
2cf565c5 64
8d308b35
JK
65Notes
66-----
67
0b444cdb
TR
68In most cases, users will not need to call 'git prune' directly, but
69should instead call 'git gc', which handles pruning along with
8d308b35
JK
70many other housekeeping tasks.
71
72For a description of which objects are considered for pruning, see
0b444cdb 73'git fsck''s --unreachable option.
8d308b35 74
56ae8df5 75SEE ALSO
8d308b35
JK
76--------
77
78linkgit:git-fsck[1],
79linkgit:git-gc[1],
80linkgit:git-reflog[1]
81
2cf565c5
DG
82GIT
83---
9e1f0a85 84Part of the linkgit:git[1] suite