1git-checkout-index(1) 2===================== 3v0.1, May 2005 4 5NAME 6---- 7git-checkout-index - Copy files from the cache to the working directory 8 9 10SYNOPSIS 11-------- 12'git-checkout-index' [-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. Cannot be used 34 together with explicit filenames. 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 47The order of the flags used to matter, but not anymore. 48 49Just doing "git-checkout-index" does nothing. You probably meant 50"git-checkout-index -a". And if you want to force it, you want 51"git-checkout-index -f -a". 52 53Intuitiveness is not the goal here. Repeatability is. The reason for 54the "no arguments means no work" thing is that from scripts you are 55supposed to be able to do things like: 56 57 find . -name '*.h' -print0 | xargs -0 git-checkout-index -f -- 58 59which will force all existing `*.h` files to be replaced with their 60cached copies. If an empty command line implied "all", then this would 61force-refresh everything in the cache, which was not the point. 62 63To update and refresh only the files already checked out: 64 65 git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh 66 67Oh, and the "--" is just a good idea when you know the rest will be 68filenames. Just so that you wouldn't have a filename of "-a" causing 69problems (not possible in the above example, but get used to it in 70scripting!). 71 72The prefix ability basically makes it trivial to use 73git-checkout-index as an "export as tree" function. Just read the 74desired tree into the index, and do a 75 76 git-checkout-index --prefix=git-export-dir/ -a 77 78and git-checkout-index will "export" the cache into the specified 79directory. 80 81NOTE The final "/" is important. The exported name is literally just 82prefixed with the specified string, so you can also do something like 83 84 git-checkout-index --prefix=.merged- Makefile 85 86to check out the currently cached copy of `Makefile` into the file 87`.merged-Makefile` 88 89Author 90------ 91Written by Linus Torvalds <torvalds@osdl.org> 92 93Documentation 94-------------- 95Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 96 97GIT 98--- 99Part of the gitlink:git[7] suite 100