Documentation / git-checkout-index.txton commit Merge git://git.kernel.org/pub/scm/gitk/gitk (90768da)
   1git-checkout-index(1)
   2=====================
   3
   4NAME
   5----
   6git-checkout-index - Copy files from the index to the working directory
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
  13                   [--stage=<number>] [--] <file>...
  14
  15DESCRIPTION
  16-----------
  17Will copy all files listed from the index to the working directory
  18(not overwriting existing files).
  19
  20OPTIONS
  21-------
  22-u|--index::
  23        update stat information for the checked out entries in
  24        the index file.
  25
  26-q|--quiet::
  27        be quiet if files exist or are not in the index
  28
  29-f|--force::
  30        forces overwrite of existing files
  31
  32-a|--all::
  33        checks out all files in the index.  Cannot be used
  34        together with explicit filenames.
  35
  36-n|--no-create::
  37        Don't checkout new files, only refresh files already checked
  38        out.
  39
  40--prefix=<string>::
  41        When creating files, prepend <string> (usually a directory
  42        including a trailing /)
  43
  44--stage=<number>::
  45        Instead of checking out unmerged entries, copy out the
  46        files from named stage.  <number> must be between 1 and 3.
  47
  48--::
  49        Do not interpret any more arguments as options.
  50
  51The order of the flags used to matter, but not anymore.
  52
  53Just doing `git-checkout-index` does nothing. You probably meant
  54`git-checkout-index -a`. And if you want to force it, you want
  55`git-checkout-index -f -a`.
  56
  57Intuitiveness is not the goal here. Repeatability is. The reason for
  58the "no arguments means no work" behavior is that from scripts you are
  59supposed to be able to do:
  60
  61----------------
  62$ find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
  63----------------
  64
  65which will force all existing `*.h` files to be replaced with their
  66cached copies. If an empty command line implied "all", then this would
  67force-refresh everything in the index, which was not the point.
  68
  69The `--` is just a good idea when you know the rest will be filenames;
  70it will prevent problems with a filename of, for example,  `-a`.
  71Using `--` is probably a good policy in scripts.
  72
  73
  74EXAMPLES
  75--------
  76To update and refresh only the files already checked out::
  77+
  78----------------
  79$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
  80----------------
  81
  82Using `git-checkout-index` to "export an entire tree"::
  83        The prefix ability basically makes it trivial to use
  84        `git-checkout-index` as an "export as tree" function.
  85        Just read the desired tree into the index, and do:
  86+
  87----------------
  88$ git-checkout-index --prefix=git-export-dir/ -a
  89----------------
  90+
  91`git-checkout-index` will "export" the index into the specified
  92directory.
  93+
  94The final "/" is important. The exported name is literally just
  95prefixed with the specified string.  Contrast this with the
  96following example.
  97
  98Export files with a prefix::
  99+
 100----------------
 101$ git-checkout-index --prefix=.merged- Makefile
 102----------------
 103+
 104This will check out the currently cached copy of `Makefile`
 105into the file `.merged-Makefile`.
 106
 107
 108Author
 109------
 110Written by Linus Torvalds <torvalds@osdl.org>
 111
 112
 113Documentation
 114--------------
 115Documentation by David Greaves,
 116Junio C Hamano and the git-list <git@vger.kernel.org>.
 117
 118
 119GIT
 120---
 121Part of the gitlink:git[7] suite
 122