1GIT-PACK-REFS(1) Git Manual GIT-PACK-REFS(1)
2
3
4
6 git-pack-refs - Pack heads and tags for efficient repository access
7
9 git pack-refs [--all] [--no-prune] [--include <pattern>] [--exclude <pattern>]
10
12 Traditionally, tips of branches and tags (collectively known as refs)
13 were stored one file per ref in a (sub)directory under $GIT_DIR/refs
14 directory. While many branch tips tend to be updated often, most tags
15 and some branch tips are never updated. When a repository has hundreds
16 or thousands of tags, this one-file-per-ref format both wastes storage
17 and hurts performance.
18
19 This command is used to solve the storage and performance problem by
20 storing the refs in a single file, $GIT_DIR/packed-refs. When a ref is
21 missing from the traditional $GIT_DIR/refs directory hierarchy, it is
22 looked up in this file and used if found.
23
24 Subsequent updates to branches always create new files under
25 $GIT_DIR/refs directory hierarchy.
26
27 A recommended practice to deal with a repository with too many refs is
28 to pack its refs with --all once, and occasionally run git pack-refs.
29 Tags are by definition stationary and are not expected to change.
30 Branch heads will be packed with the initial pack-refs --all, but only
31 the currently active branch heads will become unpacked, and the next
32 pack-refs (without --all) will leave them unpacked.
33
35 --all
36 The command by default packs all tags and refs that are already
37 packed, and leaves other refs alone. This is because branches are
38 expected to be actively developed and packing their tips does not
39 help performance. This option causes all refs to be packed as well,
40 with the exception of hidden refs, broken refs, and symbolic refs.
41 Useful for a repository with many branches of historical interests.
42
43 --no-prune
44 The command usually removes loose refs under $GIT_DIR/refs
45 hierarchy after packing them. This option tells it not to.
46
47 --include <pattern>
48 Pack refs based on a glob(7) pattern. Repetitions of this option
49 accumulate inclusion patterns. If a ref is both included in
50 --include and --exclude, --exclude takes precedence. Using
51 --include will preclude all tags from being included by default.
52 Symbolic refs and broken refs will never be packed. When used with
53 --all, it will be a noop. Use --no-include to clear and reset the
54 list of patterns.
55
56 --exclude <pattern>
57 Do not pack refs matching the given glob(7) pattern. Repetitions of
58 this option accumulate exclusion patterns. Use --no-exclude to
59 clear and reset the list of patterns. If a ref is already packed,
60 including it with --exclude will not unpack it.
61
62 When used with --all, pack only loose refs which do not match any of
63 the provided --exclude patterns.
64
65 When used with --include, refs provided to --include, minus refs that
66 are provided to --exclude will be packed.
67
69 Older documentation written before the packed-refs mechanism was
70 introduced may still say things like ".git/refs/heads/<branch> file
71 exists" when it means "branch <branch> exists".
72
74 Part of the git(1) suite
75
76
77
78Git 2.43.0 11/20/2023 GIT-PACK-REFS(1)