Documentation / git-pack-refs.txton commit Merge branch 'sg/object-as-type-commit-graph-fix' (2ed3de4)
   1git-pack-refs(1)
   2================
   3
   4NAME
   5----
   6git-pack-refs - Pack heads and tags for efficient repository access
   7
   8SYNOPSIS
   9--------
  10[verse]
  11'git pack-refs' [--all] [--no-prune]
  12
  13DESCRIPTION
  14-----------
  15
  16Traditionally, tips of branches and tags (collectively known as
  17'refs') were stored one file per ref in a (sub)directory
  18under `$GIT_DIR/refs`
  19directory.  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
  26problem by storing the refs in a single file,
  27`$GIT_DIR/packed-refs`.  When a ref is missing from the
  28traditional `$GIT_DIR/refs` directory hierarchy, it is looked
  29up in this
  30file and used if found.
  31
  32Subsequent updates to branches always create new files under
  33`$GIT_DIR/refs` directory hierarchy.
  34
  35A recommended practice to deal with a repository with too many
  36refs is to pack its refs with `--all` once, and
  37occasionally run `git pack-refs`.  Tags are by
  38definition 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,
  41and the next `pack-refs` (without `--all`) will leave them
  42unpacked.
  43
  44
  45OPTIONS
  46-------
  47
  48--all::
  49
  50The command by default packs all tags and refs that are already
  51packed, and leaves other refs
  52alone.  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
  57--no-prune::
  58
  59The command usually removes loose refs under `$GIT_DIR/refs`
  60hierarchy after packing them.  This option tells it not to.
  61
  62
  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
  71GIT
  72---
  73Part of the linkgit:git[1] suite