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