Autogenerated HTML docs for v1.2.2-g858c
[git.git] / git-checkout-index.txt
1 git-checkout-index(1)
2 =====================
3
4 NAME
5 ----
6 git-checkout-index - Copy files from the index to the working directory
7
8
9 SYNOPSIS
10 --------
11 [verse]
12 'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
13                    [--stage=<number>] [--] <file>...
14
15 DESCRIPTION
16 -----------
17 Will copy all files listed from the index to the working directory
18 (not overwriting existing files).
19
20 OPTIONS
21 -------
22 -u|--index::
23         update stat information for the checked out entries in
24         the index file.
25
26 -q|--quiet::
27         be quiet if files exist or are not in the index
28
29 -f|--force::
30         forces overwrite of existing files
31
32 -a|--all::
33         checks out all files in the index.  Cannot be used
34         together with explicit filenames.
35
36 -n|--no-create::
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
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
48 --::
49         Do not interpret any more arguments as options.
50
51 The order of the flags used to matter, but not anymore.
52
53 Just 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`.
56
57 Intuitiveness is not the goal here. Repeatability is. The reason for
58 the "no arguments means no work" behavior is that from scripts you are
59 supposed to be able to do:
60
61 ----------------
62 $ find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
63 ----------------
64
65 which will force all existing `*.h` files to be replaced with their
66 cached copies. If an empty command line implied "all", then this would
67 force-refresh everything in the index, which was not the point.
68
69 The `--` is just a good idea when you know the rest will be filenames;
70 it will prevent problems with a filename of, for example,  `-a`.
71 Using `--` is probably a good policy in scripts.
72
73
74 EXAMPLES
75 --------
76 To 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
82 Using `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
92 directory.
93 +
94 The final "/" is important. The exported name is literally just
95 prefixed with the specified string.  Contrast this with the
96 following example.
97
98 Export files with a prefix::
99 +
100 ----------------
101 $ git-checkout-index --prefix=.merged- Makefile
102 ----------------
103 +
104 This will check out the currently cached copy of `Makefile`
105 into the file `.merged-Makefile`.
106
107
108 Author
109 ------
110 Written by Linus Torvalds <torvalds@osdl.org>
111
112
113 Documentation
114 --------------
115 Documentation by David Greaves,
116 Junio C Hamano and the git-list <git@vger.kernel.org>.
117
118
119 GIT
120 ---
121 Part of the gitlink:git[7] suite
122