2 .\" Title: git-pack-refs
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.44.0.568.g436d4e5b14
10 .TH "GIT\-PACK\-REFS" "1" "2024\-04\-10" "Git 2\&.44\&.0\&.568\&.g436d4e" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-pack-refs \- Pack heads and tags for efficient repository access
35 \fIgit pack\-refs\fR [\-\-all] [\-\-no\-prune] [\-\-auto] [\-\-include <pattern>] [\-\-exclude <pattern>]
40 Traditionally, tips of branches and tags (collectively known as \fIrefs\fR) were stored one file per ref in a (sub)directory under \fB$GIT_DIR/refs\fR directory\&. While many branch tips tend to be updated often, most tags and some branch tips are never updated\&. When a repository has hundreds or thousands of tags, this one\-file\-per\-ref format both wastes storage and hurts performance\&.
42 This command is used to solve the storage and performance problem by storing the refs in a single file, \fB$GIT_DIR/packed\-refs\fR\&. When a ref is missing from the traditional \fB$GIT_DIR/refs\fR directory hierarchy, it is looked up in this file and used if found\&.
44 Subsequent updates to branches always create new files under \fB$GIT_DIR/refs\fR directory hierarchy\&.
46 A recommended practice to deal with a repository with too many refs is to pack its refs with \fB\-\-all\fR once, and occasionally run \fBgit pack\-refs\fR\&. Tags are by definition stationary and are not expected to change\&. Branch heads will be packed with the initial \fBpack\-refs \-\-all\fR, but only the currently active branch heads will become unpacked, and the next \fBpack\-refs\fR (without \fB\-\-all\fR) will leave them unpacked\&.
51 The command by default packs all tags and refs that are already packed, and leaves other refs alone\&. This is because branches are expected to be actively developed and packing their tips does not help performance\&. This option causes all refs to be packed as well, with the exception of hidden refs, broken refs, and symbolic refs\&. Useful for a repository with many branches of historical interests\&.
56 The command usually removes loose refs under
58 hierarchy after packing them\&. This option tells it not to\&.
63 Pack refs as needed depending on the current state of the ref database\&. The behavior depends on the ref format used by the repository and may change in the future\&.
73 "files": No special handling for
75 has been implemented\&.
86 "reftable": Tables are compacted such that they form a geometric sequence\&. For two tables N and N+1, where N+1 is newer, this maintains the property that N is at least twice as big as N+1\&. Only tables that violate this property are compacted\&.
94 pattern\&. Repetitions of this option accumulate inclusion patterns\&. If a ref is both included in
99 takes precedence\&. Using
101 will preclude all tags from being included by default\&. Symbolic refs and broken refs will never be packed\&. When used with
102 \fB\-\-all\fR, it will be a noop\&. Use
103 \fB\-\-no\-include\fR
104 to clear and reset the list of patterns\&.
107 \-\-exclude <pattern>
109 Do not pack refs matching the given
111 pattern\&. Repetitions of this option accumulate exclusion patterns\&. Use
112 \fB\-\-no\-exclude\fR
113 to clear and reset the list of patterns\&. If a ref is already packed, including it with
115 will not unpack it\&.
118 When used with \fB\-\-all\fR, pack only loose refs which do not match any of the provided \fB\-\-exclude\fR patterns\&.
120 When used with \fB\-\-include\fR, refs provided to \fB\-\-include\fR, minus refs that are provided to \fB\-\-exclude\fR will be packed\&.
123 Older documentation written before the packed\-refs mechanism was introduced may still say things like "\&.git/refs/heads/<branch> file exists" when it means "branch <branch> exists"\&.
126 Part of the \fBgit\fR(1) suite