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]
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 branch tips to be packed as
40 well. Useful for a repository with many branches of historical
41 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
48 Older documentation written before the packed-refs mechanism was
49 introduced may still say things like ".git/refs/heads/<branch> file
50 exists" when it means "branch <branch> exists".
51
53 Part of the git(1) suite
54
55
56
57Git 2.33.1 2021-10-12 GIT-PACK-REFS(1)