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