Autogenerated manpages for v2.44.0-191-g945115
[git-manpages.git] / man1 / git-pack-refs.1
blob26cee2223a712b44b7f9f60fed4c85e35b65a860
1 '\" t
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/>
5 .\"      Date: 2024-03-11
6 .\"    Manual: Git Manual
7 .\"    Source: Git 2.44.0.191.g945115026a
8 .\"  Language: English
9 .\"
10 .TH "GIT\-PACK\-REFS" "1" "2024\-03\-11" "Git 2\&.44\&.0\&.191\&.g945115" "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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 git-pack-refs \- Pack heads and tags for efficient repository access
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 \fIgit pack\-refs\fR [\-\-all] [\-\-no\-prune] [\-\-include <pattern>] [\-\-exclude <pattern>]
36 .fi
37 .sp
38 .SH "DESCRIPTION"
39 .sp
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\&.
41 .sp
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\&.
43 .sp
44 Subsequent updates to branches always create new files under \fB$GIT_DIR/refs\fR directory hierarchy\&.
45 .sp
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\&.
47 .SH "OPTIONS"
48 .PP
49 \-\-all
50 .RS 4
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\&.
52 .RE
53 .PP
54 \-\-no\-prune
55 .RS 4
56 The command usually removes loose refs under
57 \fB$GIT_DIR/refs\fR
58 hierarchy after packing them\&. This option tells it not to\&.
59 .RE
60 .PP
61 \-\-include <pattern>
62 .RS 4
63 Pack refs based on a
64 \fBglob(7)\fR
65 pattern\&. Repetitions of this option accumulate inclusion patterns\&. If a ref is both included in
66 \fB\-\-include\fR
67 and
68 \fB\-\-exclude\fR,
69 \fB\-\-exclude\fR
70 takes precedence\&. Using
71 \fB\-\-include\fR
72 will preclude all tags from being included by default\&. Symbolic refs and broken refs will never be packed\&. When used with
73 \fB\-\-all\fR, it will be a noop\&. Use
74 \fB\-\-no\-include\fR
75 to clear and reset the list of patterns\&.
76 .RE
77 .PP
78 \-\-exclude <pattern>
79 .RS 4
80 Do not pack refs matching the given
81 \fBglob(7)\fR
82 pattern\&. Repetitions of this option accumulate exclusion patterns\&. Use
83 \fB\-\-no\-exclude\fR
84 to clear and reset the list of patterns\&. If a ref is already packed, including it with
85 \fB\-\-exclude\fR
86 will not unpack it\&.
87 .RE
88 .sp
89 When used with \fB\-\-all\fR, pack only loose refs which do not match any of the provided \fB\-\-exclude\fR patterns\&.
90 .sp
91 When used with \fB\-\-include\fR, refs provided to \fB\-\-include\fR, minus refs that are provided to \fB\-\-exclude\fR will be packed\&.
92 .SH "BUGS"
93 .sp
94 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"\&.
95 .SH "GIT"
96 .sp
97 Part of the \fBgit\fR(1) suite