blob: f131677478e91f8ab6611a6e45dda56ff48a9e2a [file] [log] [blame]
Junio C Hamanod8c9d432006-11-07 07:19:131git-pack-refs(1)
2================
3
4NAME
5----
6git-pack-refs - Pack heads and tags for efficient repository access
7
8SYNOPSIS
9--------
Junio C Hamano15567bc2011-07-23 00:51:5910[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3811'git pack-refs' [--all] [--no-prune]
Junio C Hamanod8c9d432006-11-07 07:19:1312
13DESCRIPTION
14-----------
15
16Traditionally, tips of branches and tags (collectively known as
Junio C Hamanod0316112012-08-22 19:55:2917'refs') were stored one file per ref in a (sub)directory
18under `$GIT_DIR/refs`
Junio C Hamanod8c9d432006-11-07 07:19:1319directory. 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
Junio C Hamanod0316112012-08-22 19:55:2926problem by storing the refs in a single file,
Junio C Hamanod8c9d432006-11-07 07:19:1327`$GIT_DIR/packed-refs`. When a ref is missing from the
Junio C Hamanod0316112012-08-22 19:55:2928traditional `$GIT_DIR/refs` directory hierarchy, it is looked
29up in this
Junio C Hamanod8c9d432006-11-07 07:19:1330file and used if found.
31
Junio C Hamanoa6499d72009-04-05 09:18:1732Subsequent updates to branches always create new files under
Junio C Hamanod0316112012-08-22 19:55:2933`$GIT_DIR/refs` directory hierarchy.
Junio C Hamanod8c9d432006-11-07 07:19:1334
Junio C Hamano42b78672007-01-26 09:44:5135A recommended practice to deal with a repository with too many
36refs is to pack its refs with `--all --prune` once, and
Junio C Hamanob76a6862012-05-02 22:02:4637occasionally run `git pack-refs --prune`. Tags are by
Junio C Hamano42b78672007-01-26 09:44:5138definition 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,
Junio C Hamanoa6499d72009-04-05 09:18:1741and the next `pack-refs` (without `--all`) will leave them
Junio C Hamano42b78672007-01-26 09:44:5142unpacked.
43
44
Junio C Hamanod8c9d432006-11-07 07:19:1345OPTIONS
46-------
47
Junio C Hamanoeb415992008-06-08 22:49:4748--all::
Junio C Hamanod8c9d432006-11-07 07:19:1349
Junio C Hamano42b78672007-01-26 09:44:5150The command by default packs all tags and refs that are already
51packed, and leaves other refs
Junio C Hamanod8c9d432006-11-07 07:19:1352alone. This is because branches are expected to be actively
53developed and packing their tips does not help performance.
54This option causes branch tips to be packed as well. Useful for
55a repository with many branches of historical interests.
56
Junio C Hamanoeb415992008-06-08 22:49:4757--no-prune::
Junio C Hamanod8c9d432006-11-07 07:19:1358
Junio C Hamano1d3a6c72007-01-09 11:13:4759The command usually removes loose refs under `$GIT_DIR/refs`
60hierarchy after packing them. This option tells it not to.
61
Junio C Hamanod0316112012-08-22 19:55:2962
63BUGS
64----
65
66Older documentation written before the packed-refs mechanism was
67introduced may still say things like ".git/refs/heads/<branch> file
68exists" when it means "branch <branch> exists".
69
70
Junio C Hamanod8c9d432006-11-07 07:19:1371GIT
72---
Junio C Hamanof7c042d2008-06-06 22:50:5373Part of the linkgit:git[1] suite