Documentation / git-prune.txton commit Documentation: git-prune (c82365d)
   1git-prune(1)
   2============
   3
   4NAME
   5----
   6git-prune - Prunes all unreachable objects from the object database
   7
   8
   9SYNOPSIS
  10--------
  11'git-prune' [-n] [--] [<head>...]
  12
  13DESCRIPTION
  14-----------
  15
  16This runs `git-fsck-objects --unreachable` using the heads
  17specified on the command line (or `$GIT_DIR/refs/heads/\*` and
  18`$GIT_DIR/refs/tags/\*` if none is specified), and prunes all
  19unreachable objects from the object database.  In addition, it
  20prunes the unpacked objects that are also found in packs by
  21running `git prune-packed`.
  22
  23OPTIONS
  24-------
  25
  26-n::
  27        Do not remove anything; just report what it would
  28        remove.
  29
  30--::
  31        Do not interpret any more arguments as options.
  32
  33<head>...::
  34        Instead of keeping objects
  35        reachable from any of our references, keep objects
  36        reachable from only listed <head>s.
  37+
  38Note that the explicitly named <head>s are *not* appended to the
  39default set of references, but they replace them.  In general you
  40would want to say `git prune $(git-rev-parse --all) extra1
  41extra2` to keep chains of commits leading to extra1, extra2,
  42... in addition to what are reachable from your own refs.
  43Saying `git prune extra1 extra2` would *lose* objects reachable
  44only from the usual refs, which is usually not what you want.
  45
  46
  47EXAMPLE
  48-------
  49
  50To prune objects not used by your repository and another that
  51borrows from your repository via its
  52`.git/objects/info/alternates`:
  53
  54------------
  55$ git prune $(git-rev-parse --all) \
  56  $(cd ../another && $(git-rev-parse --all))
  57------------
  58
  59Author
  60------
  61Written by Linus Torvalds <torvalds@osdl.org>
  62
  63Documentation
  64--------------
  65Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
  66
  67GIT
  68---
  69Part of the gitlink:git[7] suite
  70