fe5e3ad24924c0a3857bdbad66c4165cf9fcac62
[git.git] / man1 / git-checkout-index.1
1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
2 .de Sh \" Subsection
3 .br
4 .if t .Sp
5 .ne 5
6 .PP
7 \fB\\$1\fR
8 .PP
9 ..
10 .de Sp \" Vertical space (when we can't use .PP)
11 .if t .sp .5v
12 .if n .sp
13 ..
14 .de Ip \" List item
15 .br
16 .ie \\n(.$>=3 .ne \\$3
17 .el .ne 3
18 .IP "\\$1" \\$2
19 ..
20 .TH "GIT-CHECKOUT-INDEX" 1 "" "" ""
21 .SH NAME
22 git-checkout-index \- Copy files from the index to the working directory
23 .SH "SYNOPSIS"
24
25
26 git\-checkout\-index [\-u] [\-q] [\-a] [\-f] [\-n] [\-\-prefix=<string>] [\-\-stage=<number>] [\-\-] <file>...
27
28 .SH "DESCRIPTION"
29
30
31 Will copy all files listed from the index to the working directory (not overwriting existing files)\&.
32
33 .SH "OPTIONS"
34
35 .TP
36 \-u|\-\-index
37 update stat information for the checked out entries in the index file\&.
38
39 .TP
40 \-q|\-\-quiet
41 be quiet if files exist or are not in the index
42
43 .TP
44 \-f|\-\-force
45 forces overwrite of existing files
46
47 .TP
48 \-a|\-\-all
49 checks out all files in the index\&. Cannot be used together with explicit filenames\&.
50
51 .TP
52 \-n|\-\-no\-create
53 Don't checkout new files, only refresh files already checked out\&.
54
55 .TP
56 \-\-prefix=<string>
57 When creating files, prepend <string> (usually a directory including a trailing /)
58
59 .TP
60 \-\-stage=<number>
61 Instead of checking out unmerged entries, copy out the files from named stage\&. <number> must be between 1 and 3\&.
62
63 .TP
64 --
65 Do not interpret any more arguments as options\&.
66
67
68 The order of the flags used to matter, but not anymore\&.
69
70
71 Just doing git\-checkout\-index does nothing\&. You probably meant git\-checkout\-index \-a\&. And if you want to force it, you want git\-checkout\-index \-f \-a\&.
72
73
74 Intuitiveness is not the goal here\&. Repeatability is\&. The reason for the "no arguments means no work" behavior is that from scripts you are supposed to be able to do:
75
76 .IP
77 $ find \&. \-name '*\&.h' \-print0 | xargs \-0 git\-checkout\-index \-f \-\-
78
79 which will force all existing *\&.h files to be replaced with their cached copies\&. If an empty command line implied "all", then this would force\-refresh everything in the index, which was not the point\&.
80
81
82 The \-\- is just a good idea when you know the rest will be filenames; it will prevent problems with a filename of, for example, \-a\&. Using \-\- is probably a good policy in scripts\&.
83
84 .SH "EXAMPLES"
85
86 .TP
87 To update and refresh only the files already checked out
88
89 .IP
90 $ git\-checkout\-index \-n \-f \-a && git\-update\-index \-\-ignore\-missing \-\-refresh
91 .TP
92 Using git\-checkout\-index to "export an entire tree"
93 The prefix ability basically makes it trivial to use git\-checkout\-index as an "export as tree" function\&. Just read the desired tree into the index, and do:
94
95
96 .IP
97 $ git\-checkout\-index \-\-prefix=git\-export\-dir/ \-agit\-checkout\-index will "export" the index into the specified directory\&.
98
99 The final "/" is important\&. The exported name is literally just prefixed with the specified string\&. Contrast this with the following example\&.
100
101 .TP
102 Export files with a prefix
103
104 .IP
105 $ git\-checkout\-index \-\-prefix=\&.merged\- MakefileThis will check out the currently cached copy of Makefile into the file \&.merged\-Makefile\&.
106
107 .SH "AUTHOR"
108
109
110 Written by Linus Torvalds <torvalds@osdl\&.org>
111
112 .SH "DOCUMENTATION"
113
114
115 Documentation by David Greaves, Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
116
117 .SH "GIT"
118
119
120 Part of the \fBgit\fR(7) suite
121