1GIT-CHECKOUT-INDEX(1) Git Manual GIT-CHECKOUT-INDEX(1)
2
3
4
6 git-checkout-index - Copy files from the index to the working tree
7
9 git-checkout-index [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
10 [--stage=<number>|all]
11 [--temp]
12 [-z] [--stdin]
13 [--] [<file>]*
14
16 Will copy all files listed from the index to the working directory (not
17 overwriting existing files).
18
20 -u|--index
21 update stat information for the checked out entries in the index
22 file.
23
24 -q|--quiet
25 be quiet if files exist or are not in the index
26
27 -f|--force
28 forces overwrite of existing files
29
30 -a|--all
31 checks out all files in the index. Cannot be used together with
32 explicit filenames.
33
34 -n|--no-create
35 Don´t checkout new files, only refresh files already checked out.
36
37 --prefix=<string>
38 When creating files, prepend <string> (usually a directory
39 including a trailing /)
40
41 --stage=<number>|all
42 Instead of checking out unmerged entries, copy out the files from
43 named stage. <number> must be between 1 and 3. Note: --stage=all
44 automatically implies --temp.
45
46 --temp
47 Instead of copying the files to the working directory write the
48 content to temporary files. The temporary name associations will be
49 written to stdout.
50
51 --stdin
52 Instead of taking list of paths from the command line, read list of
53 paths from the standard input. Paths are separated by LF (i.e. one
54 path per line) by default.
55
56 -z
57 Only meaningful with --stdin; paths are separated with NUL
58 character instead of LF.
59
60 --
61 Do not interpret any more arguments as options.
62 The order of the flags used to matter, but not anymore.
63
64 Just doing git-checkout-index does nothing. You probably meant
65 git-checkout-index -a. And if you want to force it, you want
66 git-checkout-index -f -a.
67
68 Intuitiveness is not the goal here. Repeatability is. The reason for
69 the "no arguments means no work" behavior is that from scripts you are
70 supposed to be able to do:
71
72
73
74 $ find . -name ´*.h´ -print0 | xargs -0 git-checkout-index -f --
75
76 which will force all existing *.h files to be replaced with their
77 cached copies. If an empty command line implied "all", then this would
78 force-refresh everything in the index, which was not the point. But
79 since git-checkout-index accepts --stdin it would be faster to use:
80
81
82
83 $ find . -name ´*.h´ -print0 | git-checkout-index -f -z --stdin
84
85 The -- is just a good idea when you know the rest will be filenames; it
86 will prevent problems with a filename of, for example, -a. Using -- is
87 probably a good policy in scripts.
88
90 When --temp is used (or implied by --stage=all) git-checkout-index will
91 create a temporary file for each index entry being checked out. The
92 index will not be updated with stat information. These options can be
93 useful if the caller needs all stages of all unmerged entries so that
94 the unmerged files can be processed by an external merge tool.
95
96 A listing will be written to stdout providing the association of
97 temporary file names to tracked path names. The listing format has two
98 variations:
99
100
101 1. tempname TAB path RS
102
103 The first format is what gets used when --stage is omitted or is
104 not --stage=all. The field tempname is the temporary file name
105 holding the file content and path is the tracked path name in the
106 index. Only the requested entries are output.
107
108 2. stage1temp SP stage2temp SP stage3tmp TAB path RS
109
110 The second format is what gets used when --stage=all. The three
111 stage temporary fields (stage1temp, stage2temp, stage3temp) list
112 the name of the temporary file if there is a stage entry in the
113 index or . if there is no stage entry. Paths which only have a
114 stage 0 entry will always be omitted from the output.
115 In both formats RS (the record separator) is newline by default but
116 will be the null byte if -z was passed on the command line. The
117 temporary file names are always safe strings; they will never contain
118 directory separators or whitespace characters. The path field is always
119 relative to the current directory and the temporary file names are
120 always relative to the top level directory.
121
122 If the object being copied out to a temporary file is a symbolic link
123 the content of the link will be written to a normal file. It is up to
124 the end-user or the Porcelain to make use of this information.
125
127 To update and refresh only the files already checked out
128
129
130 $ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
131
132
133 Using git-checkout-index to "export an entire tree"
134 The prefix ability basically makes it trivial to use
135 git-checkout-index as an "export as tree" function. Just read the
136 desired tree into the index, and do:
137
138
139
140 $ git-checkout-index --prefix=git-export-dir/ -a
141
142 git-checkout-index will "export" the index into the specified
143 directory.
144
145 The final "/" is important. The exported name is literally just
146 prefixed with the specified string. Contrast this with the
147 following example.
148
149 Export files with a prefix
150
151
152 $ git-checkout-index --prefix=.merged- Makefile
153
154 This will check out the currently cached copy of Makefile into the
155 file .merged-Makefile.
156
158 Written by Linus Torvalds <torvalds@osdl.org>
159
161 Documentation by David Greaves, Junio C Hamano and the git-list
162 <git@vger.kernel.org>.
163
165 Part of the git(7) suite
166
167
168
169
170Git 1.5.3.3 10/09/2007 GIT-CHECKOUT-INDEX(1)