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' [-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-q:: 23 be quiet if files exist or are not in the cache 24 25-f:: 26 forces overwrite of existing files 27 28-a:: 29 checks out all files in the cache (will then continue to 30 process listed files). 31 32-n:: 33 Don't checkout new files, only refresh files already checked 34 out. 35 36--prefix=<string>:: 37 When creating files, prepend <string> (usually a directory 38 including a trailing /) 39 40--:: 41 Do not interpret any more arguments as options. 42 43Note that the order of the flags matters: 44 45 git-checkout-cache -a -f file.c 46 47will first check out all files listed in the cache (but not overwrite 48any old ones), and then force-checkout `file.c` a second time (ie that 49one *will* overwrite any old contents with the same filename). 50 51Also, just doing "git-checkout-cache" does nothing. You probably meant 52"git-checkout-cache -a". And if you want to force it, you want 53"git-checkout-cache -f -a". 54 55Intuitiveness is not the goal here. Repeatability is. The reason for 56the "no arguments means no work" thing is that from scripts you are 57supposed to be able to do things like: 58 59 find . -name '*.h' -print0 | xargs -0 git-checkout-cache -f -- 60 61which will force all existing `*.h` files to be replaced with their 62cached copies. If an empty command line implied "all", then this would 63force-refresh everything in the cache, which was not the point. 64 65To update and refresh only the files already checked out: 66 67 git-checkout-cache -n -f -a && git-update-cache --ignore-missing --refresh 68 69Oh, and the "--" is just a good idea when you know the rest will be 70filenames. Just so that you wouldn't have a filename of "-a" causing 71problems (not possible in the above example, but get used to it in 72scripting!). 73 74The prefix ability basically makes it trivial to use 75git-checkout-cache as an "export as tree" function. Just read the 76desired tree into the index, and do a 77 78 git-checkout-cache --prefix=git-export-dir/ -a 79 80and git-checkout-cache will "export" the cache into the specified 81directory. 82 83NOTE The final "/" is important. The exported name is literally just 84prefixed with the specified string, so you can also do something like 85 86 git-checkout-cache --prefix=.merged- Makefile 87 88to check out the currently cached copy of `Makefile` into the file 89`.merged-Makefile` 90 91Author 92------ 93Written by Linus Torvalds <torvalds@osdl.org> 94 95Documentation 96-------------- 97Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. 98 99GIT 100--- 101Part of the link:git.html[git] suite 102