Documentation: git-prune
[git.git] / Documentation / git-prune.txt
1 git-prune(1)
2 ============
3
4 NAME
5 ----
6 git-prune - Prunes all unreachable objects from the object database
7
8
9 SYNOPSIS
10 --------
11 'git-prune' [-n] [--] [<head>...]
12
13 DESCRIPTION
14 -----------
15
16 This runs `git-fsck-objects --unreachable` using the heads
17 specified on the command line (or `$GIT_DIR/refs/heads/\*` and
18 `$GIT_DIR/refs/tags/\*` if none is specified), and prunes all
19 unreachable objects from the object database.  In addition, it
20 prunes the unpacked objects that are also found in packs by
21 running `git prune-packed`.
22
23 OPTIONS
24 -------
25
26 -n::
27         Do not remove anything; just report what it would
28         remove.
29
30 --::
31         Do not interpret any more arguments as options.
32
33 <head>...::
34         Instead of keeping objects
35         reachable from any of our references, keep objects
36         reachable from only listed <head>s.
37 +
38 Note that the explicitly named <head>s are *not* appended to the
39 default set of references, but they replace them.  In general you
40 would want to say `git prune $(git-rev-parse --all) extra1
41 extra2` to keep chains of commits leading to extra1, extra2,
42 ... in addition to what are reachable from your own refs.
43 Saying `git prune extra1 extra2` would *lose* objects reachable
44 only from the usual refs, which is usually not what you want.
45
46
47 EXAMPLE
48 -------
49
50 To prune objects not used by your repository and another that
51 borrows from your repository via its
52 `.git/objects/info/alternates`:
53
54 ------------
55 $ git prune $(git-rev-parse --all) \
56   $(cd ../another && $(git-rev-parse --all))
57 ------------
58
59 Author
60 ------
61 Written by Linus Torvalds <torvalds@osdl.org>
62
63 Documentation
64 --------------
65 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
66
67 GIT
68 ---
69 Part of the gitlink:git[7] suite
70