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