]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-pack-refs.txt
Merge branch 'jk/ci-retire-allow-ref'
[thirdparty/git.git] / Documentation / git-pack-refs.txt
CommitLineData
d28f7cb9
JH
1git-pack-refs(1)
2================
3
4NAME
5----
6git-pack-refs - Pack heads and tags for efficient repository access
7
8SYNOPSIS
9--------
7791a1d9 10[verse]
4fe42f32 11'git pack-refs' [--all] [--no-prune] [--include <pattern>] [--exclude <pattern>]
d28f7cb9
JH
12
13DESCRIPTION
14-----------
15
16Traditionally, tips of branches and tags (collectively known as
831e61f8
JH
17'refs') were stored one file per ref in a (sub)directory
18under `$GIT_DIR/refs`
d28f7cb9
JH
19directory. While many branch tips tend to be updated often,
20most tags and some branch tips are never updated. When a
21repository has hundreds or thousands of tags, this
22one-file-per-ref format both wastes storage and hurts
23performance.
24
25This command is used to solve the storage and performance
831e61f8 26problem by storing the refs in a single file,
d28f7cb9 27`$GIT_DIR/packed-refs`. When a ref is missing from the
831e61f8
JH
28traditional `$GIT_DIR/refs` directory hierarchy, it is looked
29up in this
d28f7cb9
JH
30file and used if found.
31
38b7ccbe 32Subsequent updates to branches always create new files under
831e61f8 33`$GIT_DIR/refs` directory hierarchy.
d28f7cb9 34
af67e91c 35A recommended practice to deal with a repository with too many
4a81bfa1
JM
36refs is to pack its refs with `--all` once, and
37occasionally run `git pack-refs`. Tags are by
af67e91c
JH
38definition stationary and are not expected to change. Branch
39heads will be packed with the initial `pack-refs --all`, but
40only the currently active branch heads will become unpacked,
38b7ccbe 41and the next `pack-refs` (without `--all`) will leave them
af67e91c
JH
42unpacked.
43
44
d28f7cb9
JH
45OPTIONS
46-------
47
3240240f 48--all::
d28f7cb9 49
af67e91c
JH
50The command by default packs all tags and refs that are already
51packed, and leaves other refs
d28f7cb9
JH
52alone. This is because branches are expected to be actively
53developed and packing their tips does not help performance.
283174b2
JC
54This option causes all refs to be packed as well, with the exception
55of hidden refs, broken refs, and symbolic refs. Useful for a repository
56with many branches of historical interests.
d28f7cb9 57
3240240f 58--no-prune::
0f018bab
JH
59
60The command usually removes loose refs under `$GIT_DIR/refs`
61hierarchy after packing them. This option tells it not to.
d28f7cb9 62
4fe42f32
JC
63--include <pattern>::
64
65Pack refs based on a `glob(7)` pattern. Repetitions of this option
66accumulate inclusion patterns. If a ref is both included in `--include` and
67`--exclude`, `--exclude` takes precedence. Using `--include` will preclude all
68tags from being included by default. Symbolic refs and broken refs will never
69be packed. When used with `--all`, it will be a noop. Use `--no-include` to clear
70and reset the list of patterns.
71
826ae79f
JC
72--exclude <pattern>::
73
74Do not pack refs matching the given `glob(7)` pattern. Repetitions of this option
75accumulate exclusion patterns. Use `--no-exclude` to clear and reset the list of
76patterns. If a ref is already packed, including it with `--exclude` will not
77unpack it.
78
79When used with `--all`, pack only loose refs which do not match any of
80the provided `--exclude` patterns.
81
4fe42f32
JC
82When used with `--include`, refs provided to `--include`, minus refs that are
83provided to `--exclude` will be packed.
84
831e61f8
JH
85
86BUGS
87----
88
89Older documentation written before the packed-refs mechanism was
90introduced may still say things like ".git/refs/heads/<branch> file
91exists" when it means "branch <branch> exists".
92
93
d28f7cb9
JH
94GIT
95---
9e1f0a85 96Part of the linkgit:git[1] suite