Documentation / git-prune.txton commit Git 2.13-rc0 (6a2c2f8)
   1git-prune(1)
   2============
   3
   4NAME
   5----
   6git-prune - Prune all unreachable objects from the object database
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git prune' [-n] [-v] [--expire <expire>] [--] [<head>...]
  13
  14DESCRIPTION
  15-----------
  16
  17NOTE: In most cases, users should run 'git gc', which calls
  18'git prune'. See the section "NOTES", below.
  19
  20This runs 'git fsck --unreachable' using all the refs
  21available in `refs/`, optionally with additional set of
  22objects specified on the command line, and prunes all unpacked
  23objects unreachable from any of these head objects from the object database.
  24In addition, it
  25prunes the unpacked objects that are also found in packs by
  26running 'git prune-packed'.
  27It also removes entries from .git/shallow that are not reachable by
  28any ref.
  29
  30Note that unreachable, packed objects will remain.  If this is
  31not desired, see linkgit:git-repack[1].
  32
  33OPTIONS
  34-------
  35
  36-n::
  37--dry-run::
  38        Do not remove anything; just report what it would
  39        remove.
  40
  41-v::
  42--verbose::
  43        Report all removed objects.
  44
  45\--::
  46        Do not interpret any more arguments as options.
  47
  48--expire <time>::
  49        Only expire loose objects older than <time>.
  50
  51<head>...::
  52        In addition to objects
  53        reachable from any of our references, keep objects
  54        reachable from listed <head>s.
  55
  56EXAMPLE
  57-------
  58
  59To prune objects not used by your repository or another that
  60borrows from your repository via its
  61`.git/objects/info/alternates`:
  62
  63------------
  64$ git prune $(cd ../another && git rev-parse --all)
  65------------
  66
  67Notes
  68-----
  69
  70In most cases, users will not need to call 'git prune' directly, but
  71should instead call 'git gc', which handles pruning along with
  72many other housekeeping tasks.
  73
  74For a description of which objects are considered for pruning, see
  75'git fsck''s --unreachable option.
  76
  77SEE ALSO
  78--------
  79
  80linkgit:git-fsck[1],
  81linkgit:git-gc[1],
  82linkgit:git-reflog[1]
  83
  84GIT
  85---
  86Part of the linkgit:git[1] suite