[PATCH] Add the merge test Linus called "test script from hell".
[git/gitweb.git] / Documentation / git-checkout-cache.txt
blob9d41626d970b8ac909742de57d3e1df40c759016
1 git-checkout-cache(1)
2 =====================
3 v0.1, May 2005
5 NAME
6 ----
7 git-checkout-cache - Copy files from the cache to the working directory
10 SYNOPSIS
11 --------
12 'git-checkout-cache' [-q] [-a] [-f] [-n] [--prefix=<string>]
13                    [--] <file>...
15 DESCRIPTION
16 -----------
17 Will copy all files listed from the cache to the working directory
18 (not overwriting existing files).
20 OPTIONS
21 -------
22 -q::
23         be quiet if files exist or are not in the cache
25 -f::
26         forces overwrite of existing files
28 -a::
29         checks out all files in the cache (will then continue to
30         process listed files).
32 -n::
33         Don't checkout new files, only refresh files already checked
34         out.
36 --prefix=<string>::
37         When creating files, prepend <string> (usually a directory
38         including a trailing /)
40 --::
41         Do not interpret any more arguments as options.
43 Note that the order of the flags matters:
45      git-checkout-cache -a -f file.c
47 will first check out all files listed in the cache (but not overwrite
48 any old ones), and then force-checkout `file.c` a second time (ie that
49 one *will* overwrite any old contents with the same filename).
51 Also, 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".
55 Intuitiveness is not the goal here. Repeatability is. The reason for
56 the "no arguments means no work" thing is that from scripts you are
57 supposed to be able to do things like:
59         find . -name '*.h' -print0 | xargs -0 git-checkout-cache -f --
61 which will force all existing `*.h` files to be replaced with their
62 cached copies. If an empty command line implied "all", then this would
63 force-refresh everything in the cache, which was not the point.
65 To update and refresh only the files already checked out:
67         git-checkout-cache -n -f -a && git-update-cache --ignore-missing --refresh
69 Oh, and the "--" is just a good idea when you know the rest will be
70 filenames. Just so that you wouldn't have a filename of "-a" causing
71 problems (not possible in the above example, but get used to it in
72 scripting!).
74 The prefix ability basically makes it trivial to use
75 git-checkout-cache as an "export as tree" function. Just read the
76 desired tree into the index, and do a
77   
78         git-checkout-cache --prefix=git-export-dir/ -a
79   
80 and git-checkout-cache will "export" the cache into the specified
81 directory.
82   
83 NOTE The final "/" is important. The exported name is literally just
84 prefixed with the specified string, so you can also do something like
86     git-checkout-cache --prefix=.merged- Makefile
88 to check out the currently cached copy of `Makefile` into the file
89 `.merged-Makefile`
91 Author
92 ------
93 Written by Linus Torvalds <torvalds@osdl.org>
95 Documentation
96 --------------
97 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
99 GIT
101 Part of the link:git.html[git] suite