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