]>
Commit | Line | Data |
---|---|---|
215a7ad1 | 1 | git-checkout-index(1) |
2cf565c5 | 2 | ===================== |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
5f3aa197 | 6 | git-checkout-index - Copy files from the index to the working directory |
2cf565c5 DG |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
353ce815 | 11 | [verse] |
215a7ad1 | 12 | 'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>] |
353ce815 | 13 | [--stage=<number>] [--] <file>... |
2cf565c5 DG |
14 | |
15 | DESCRIPTION | |
16 | ----------- | |
5f3aa197 | 17 | Will copy all files listed from the index to the working directory |
2cf565c5 DG |
18 | (not overwriting existing files). |
19 | ||
20 | OPTIONS | |
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 | 51 | The order of the flags used to matter, but not anymore. |
2cf565c5 | 52 | |
61f693bd JL |
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`. | |
2cf565c5 DG |
56 | |
57 | Intuitiveness is not the goal here. Repeatability is. The reason for | |
61f693bd JL |
58 | the "no arguments means no work" behavior is that from scripts you are |
59 | supposed 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 | |
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 | |
5f3aa197 | 67 | force-refresh everything in the index, which was not the point. |
2cf565c5 | 68 | |
61f693bd JL |
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. | |
2cf565c5 | 72 | |
2cf565c5 | 73 | |
61f693bd JL |
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 | |
2cf565c5 | 92 | directory. |
61f693bd JL |
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. | |
fd25c82a | 97 | |
61f693bd JL |
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`. | |
2cf565c5 | 106 | |
2cf565c5 DG |
107 | |
108 | Author | |
109 | ------ | |
110 | Written by Linus Torvalds <torvalds@osdl.org> | |
111 | ||
61f693bd | 112 | |
2cf565c5 DG |
113 | Documentation |
114 | -------------- | |
61f693bd JL |
115 | Documentation by David Greaves, |
116 | Junio C Hamano and the git-list <git@vger.kernel.org>. | |
117 | ||
2cf565c5 DG |
118 | |
119 | GIT | |
120 | --- | |
a7154e91 | 121 | Part of the gitlink:git[7] suite |
2cf565c5 | 122 |