Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 1 | git-pack-refs(1) |
| 2 | ================ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-pack-refs - Pack heads and tags for efficient repository access |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 10 | [verse] |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 11 | 'git pack-refs' [--all] [--no-prune] |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 12 | |
| 13 | DESCRIPTION |
| 14 | ----------- |
| 15 | |
| 16 | Traditionally, tips of branches and tags (collectively known as |
Junio C Hamano | d031611 | 2012-08-22 19:55:29 | [diff] [blame] | 17 | 'refs') were stored one file per ref in a (sub)directory |
| 18 | under `$GIT_DIR/refs` |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 19 | directory. While many branch tips tend to be updated often, |
| 20 | most tags and some branch tips are never updated. When a |
| 21 | repository has hundreds or thousands of tags, this |
| 22 | one-file-per-ref format both wastes storage and hurts |
| 23 | performance. |
| 24 | |
| 25 | This command is used to solve the storage and performance |
Junio C Hamano | d031611 | 2012-08-22 19:55:29 | [diff] [blame] | 26 | problem by storing the refs in a single file, |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 27 | `$GIT_DIR/packed-refs`. When a ref is missing from the |
Junio C Hamano | d031611 | 2012-08-22 19:55:29 | [diff] [blame] | 28 | traditional `$GIT_DIR/refs` directory hierarchy, it is looked |
| 29 | up in this |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 30 | file and used if found. |
| 31 | |
Junio C Hamano | a6499d7 | 2009-04-05 09:18:17 | [diff] [blame] | 32 | Subsequent updates to branches always create new files under |
Junio C Hamano | d031611 | 2012-08-22 19:55:29 | [diff] [blame] | 33 | `$GIT_DIR/refs` directory hierarchy. |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 34 | |
Junio C Hamano | 42b7867 | 2007-01-26 09:44:51 | [diff] [blame] | 35 | A recommended practice to deal with a repository with too many |
| 36 | refs is to pack its refs with `--all --prune` once, and |
Junio C Hamano | b76a686 | 2012-05-02 22:02:46 | [diff] [blame] | 37 | occasionally run `git pack-refs --prune`. Tags are by |
Junio C Hamano | 42b7867 | 2007-01-26 09:44:51 | [diff] [blame] | 38 | definition stationary and are not expected to change. Branch |
| 39 | heads will be packed with the initial `pack-refs --all`, but |
| 40 | only the currently active branch heads will become unpacked, |
Junio C Hamano | a6499d7 | 2009-04-05 09:18:17 | [diff] [blame] | 41 | and the next `pack-refs` (without `--all`) will leave them |
Junio C Hamano | 42b7867 | 2007-01-26 09:44:51 | [diff] [blame] | 42 | unpacked. |
| 43 | |
| 44 | |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 45 | OPTIONS |
| 46 | ------- |
| 47 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 48 | --all:: |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 49 | |
Junio C Hamano | 42b7867 | 2007-01-26 09:44:51 | [diff] [blame] | 50 | The command by default packs all tags and refs that are already |
| 51 | packed, and leaves other refs |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 52 | alone. This is because branches are expected to be actively |
| 53 | developed and packing their tips does not help performance. |
| 54 | This option causes branch tips to be packed as well. Useful for |
| 55 | a repository with many branches of historical interests. |
| 56 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 57 | --no-prune:: |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 58 | |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 59 | The command usually removes loose refs under `$GIT_DIR/refs` |
| 60 | hierarchy after packing them. This option tells it not to. |
| 61 | |
Junio C Hamano | d031611 | 2012-08-22 19:55:29 | [diff] [blame] | 62 | |
| 63 | BUGS |
| 64 | ---- |
| 65 | |
| 66 | Older documentation written before the packed-refs mechanism was |
| 67 | introduced may still say things like ".git/refs/heads/<branch> file |
| 68 | exists" when it means "branch <branch> exists". |
| 69 | |
| 70 | |
Junio C Hamano | d8c9d43 | 2006-11-07 07:19:13 | [diff] [blame] | 71 | GIT |
| 72 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 73 | Part of the linkgit:git[1] suite |