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