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