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