Documentation / git-checkout-cache.txton commit Merge with master. (e764a10)
   1git-checkout-cache(1)
   2=====================
   3v0.1, May 2005
   4
   5NAME
   6----
   7git-checkout-cache - Copy files from the cache to the working directory
   8
   9
  10SYNOPSIS
  11--------
  12'git-checkout-cache' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
  13                   [--] <file>...
  14
  15DESCRIPTION
  16-----------
  17Will copy all files listed from the cache to the working directory
  18(not overwriting existing files).
  19
  20OPTIONS
  21-------
  22-u::
  23        update stat information for the checked out entries in
  24        the cache file.
  25
  26-q::
  27        be quiet if files exist or are not in the cache
  28
  29-f::
  30        forces overwrite of existing files
  31
  32-a::
  33        checks out all files in the cache (will then continue to
  34        process listed files).
  35
  36-n::
  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--::
  45        Do not interpret any more arguments as options.
  46
  47Note that the order of the flags matters:
  48
  49     git-checkout-cache -a -f file.c
  50
  51will first check out all files listed in the cache (but not overwrite
  52any old ones), and then force-checkout `file.c` a second time (ie that
  53one *will* overwrite any old contents with the same filename).
  54
  55Also, just doing "git-checkout-cache" does nothing. You probably meant
  56"git-checkout-cache -a". And if you want to force it, you want
  57"git-checkout-cache -f -a".
  58
  59Intuitiveness is not the goal here. Repeatability is. The reason for
  60the "no arguments means no work" thing is that from scripts you are
  61supposed to be able to do things like:
  62
  63        find . -name '*.h' -print0 | xargs -0 git-checkout-cache -f --
  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 cache, which was not the point.
  68
  69To update and refresh only the files already checked out:
  70
  71        git-checkout-cache -n -f -a && git-update-cache --ignore-missing --refresh
  72
  73Oh, and the "--" is just a good idea when you know the rest will be
  74filenames. Just so that you wouldn't have a filename of "-a" causing
  75problems (not possible in the above example, but get used to it in
  76scripting!).
  77
  78The prefix ability basically makes it trivial to use
  79git-checkout-cache as an "export as tree" function. Just read the
  80desired tree into the index, and do a
  81  
  82        git-checkout-cache --prefix=git-export-dir/ -a
  83  
  84and git-checkout-cache will "export" the cache into the specified
  85directory.
  86  
  87NOTE The final "/" is important. The exported name is literally just
  88prefixed with the specified string, so you can also do something like
  89
  90    git-checkout-cache --prefix=.merged- Makefile
  91
  92to check out the currently cached copy of `Makefile` into the file
  93`.merged-Makefile`
  94
  95Author
  96------
  97Written by Linus Torvalds <torvalds@osdl.org>
  98
  99Documentation
 100--------------
 101Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
 102
 103GIT
 104---
 105Part of the link:git.html[git] suite
 106