Added documentation for few missing options.
More $ shell prompts in examples. Minor English grammar improvements. Added a few "See Also"s. Use back-ticks on more command examples. Signed-off-by: Jon Loeliger <jdl@freescale.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jon Loeliger committed
Dec 5, 2005 at 23:13 UTC
61f693bd5a2ab4d830aad6fce0a1c70863f38009
6 files changed
+139
-79
Documentation/git-checkout-index.txt
+45
-27
@@ -45,53 +45,71 @@ OPTIONS
45
46
The order of the flags used to matter, but not anymore.
47
48
-Just doing "git-checkout-index" does nothing. You probably meant
49
-"git-checkout-index -a". And if you want to force it, you want
50
-"git-checkout-index -f -a".
48
+Just doing `git-checkout-index` does nothing. You probably meant
49
+`git-checkout-index -a`. And if you want to force it, you want
50
+`git-checkout-index -f -a`.
51
52
Intuitiveness is not the goal here. Repeatability is. The reason for
53
-the "no arguments means no work" thing is that from scripts you are
54
-supposed to be able to do things like:
53
+the "no arguments means no work" behavior is that from scripts you are
54
+supposed to be able to do:
55
56
- find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
56
+----------------
57
+$ find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
58
+----------------
59
60
which will force all existing `*.h` files to be replaced with their
61
cached copies. If an empty command line implied "all", then this would
62
force-refresh everything in the index, which was not the point.
63
62
-To update and refresh only the files already checked out:
64
+The `--` is just a good idea when you know the rest will be filenames;
65
+it will prevent problems with a filename of, for example, `-a`.
66
+Using `--` is probably a good policy in scripts.
67
64
- git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
68
66
-Oh, and the "--" is just a good idea when you know the rest will be
67
-filenames. Just so that you wouldn't have a filename of "-a" causing
68
-problems (not possible in the above example, but get used to it in
69
-scripting!).
70
-
71
-The prefix ability basically makes it trivial to use
72
-git-checkout-index as an "export as tree" function. Just read the
73
-desired tree into the index, and do a
74
-
75
- git-checkout-index --prefix=git-export-dir/ -a
76
-
77
-and git-checkout-index will "export" the index into the specified
69
+EXAMPLES
70
+--------
71
+To update and refresh only the files already checked out::
72
++
73
+----------------
74
+$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
75
+----------------
76
+
77
+Using `git-checkout-index` to "export an entire tree"::
78
+ The prefix ability basically makes it trivial to use
79
+ `git-checkout-index` as an "export as tree" function.
80
+ Just read the desired tree into the index, and do:
81
++
82
+----------------
83
+$ git-checkout-index --prefix=git-export-dir/ -a
84
+----------------
85
++
86
+`git-checkout-index` will "export" the index into the specified
87
directory.
88
++
89
+The final "/" is important. The exported name is literally just
90
+prefixed with the specified string. Contrast this with the
91
+following example.
92
80
-NOTE The final "/" is important. The exported name is literally just
81
-prefixed with the specified string, so you can also do something like
93
+Export files with a prefix::
94
++
95
+----------------
96
+$ git-checkout-index --prefix=.merged- Makefile
97
+----------------
98
++
99
+This will check out the currently cached copy of `Makefile`
100
+into the file `.merged-Makefile`.
101
83
- git-checkout-index --prefix=.merged- Makefile
84
-
85
-to check out the currently cached copy of `Makefile` into the file
86
-`.merged-Makefile`
102
103
Author
104
------
105
Written by Linus Torvalds <torvalds@osdl.org>
106
107
+
108
Documentation
109
--------------
94
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
110
+Documentation by David Greaves,
111
+Junio C Hamano and the git-list <git@vger.kernel.org>.
112
+
113
114
GIT
115
---
Documentation/git-init-db.txt
+23
-4
@@ -8,7 +8,14 @@ git-init-db - Creates an empty git repository
8
9
SYNOPSIS
10
--------
11
-'git-init-db'
11
+'git-init-db' [--template=<template_directory>]
12
+
13
+
14
+OPTIONS
15
+-------
16
+--template=<template_directory>::
17
+ Provide the directory in from which templates will be used.
18
+
19
20
DESCRIPTION
21
-----------
@@ -16,14 +23,26 @@ This simply creates an empty git repository - basically a `.git` directory
23
and `.git/object/??/`, `.git/refs/heads` and `.git/refs/tags` directories,
24
and links `.git/HEAD` symbolically to `.git/refs/heads/master`.
25
19
-If the 'GIT_DIR' environment variable is set then it specifies a path
26
+If the `$GIT_DIR` environment variable is set then it specifies a path
27
to use instead of `./.git` for the base of the repository.
28
22
-If the object storage directory is specified via the 'GIT_OBJECT_DIRECTORY'
29
+If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY`
30
environment variable then the sha1 directories are created underneath -
31
otherwise the default `$GIT_DIR/objects` directory is used.
32
26
-"git-init-db" won't hurt an existing repository.
33
+`git-init-db` won't hurt an existing repository.
34
+
35
+
36
+EXAMPLES
37
+--------
38
+
39
+Start a new git repository for an existing code base::
40
++
41
+----------------
42
+$ cd /path/to/my/codebase
43
+$ git-init-db
44
+----------------
45
+
46
47
48
Author
Documentation/git-prune-packed.txt
+7
-4
@@ -9,19 +9,22 @@ residing in a pack file.
9
10
SYNOPSIS
11
--------
12
-'git-prune-packed'
12
+'git-prune-packed' [-n]
13
+
14
15
DESCRIPTION
16
-----------
16
-This program search the GIT_OBJECT_DIR for all objects that currently exist in
17
-a pack file as well as the independent object directories.
17
+This program search the `$GIT_OBJECT_DIR` for all objects that currently
18
+exist in a pack file as well as the independent object directories.
19
20
All such extra objects are removed.
21
22
A pack is a collection of objects, individually compressed, with delta
23
compression applied, stored in a single file, with an associated index file.
24
24
-Packs are used to reduce the load on mirror systems, backup engines, disk storage, etc.
25
+Packs are used to reduce the load on mirror systems, backup engines,
26
+disk storage, etc.
27
+
28
29
OPTIONS
30
-------
Documentation/git-read-tree.txt
+41
-33
@@ -15,15 +15,15 @@ DESCRIPTION
15
-----------
16
Reads the tree information given by <tree-ish> into the index,
17
but does not actually *update* any of the files it "caches". (see:
18
-git-checkout-index)
18
+gitlink:git-checkout-index[1])
19
20
Optionally, it can merge a tree into the index, perform a
21
-fast-forward (i.e. 2-way) merge, or a 3-way merge, with the -m
22
-flag. When used with -m, the -u flag causes it to also update
21
+fast-forward (i.e. 2-way) merge, or a 3-way merge, with the `-m`
22
+flag. When used with `-m`, the `-u` flag causes it to also update
23
the files in the work tree with the result of the merge.
24
25
-Trivial merges are done by "git-read-tree" itself. Only conflicting paths
26
-will be in unmerged state when "git-read-tree" returns.
25
+Trivial merges are done by `git-read-tree` itself. Only conflicting paths
26
+will be in unmerged state when `git-read-tree` returns.
27
28
OPTIONS
29
-------
@@ -56,7 +56,7 @@ OPTIONS
56
57
Merging
58
-------
59
-If '-m' is specified, "git-read-tree" can perform 3 kinds of
59
+If `-m` is specified, `git-read-tree` can perform 3 kinds of
60
merge, a single tree merge if only 1 tree is given, a
61
fast-forward merge with 2 trees, or a 3-way merge if 3 trees are
62
provided.
@@ -65,23 +65,23 @@ provided.
65
Single Tree Merge
66
~~~~~~~~~~~~~~~~~
67
If only 1 tree is specified, git-read-tree operates as if the user did not
68
-specify '-m', except that if the original index has an entry for a
68
+specify `-m`, except that if the original index has an entry for a
69
given pathname, and the contents of the path matches with the tree
70
being read, the stat info from the index is used. (In other words, the
71
index's stat()s take precedence over the merged tree's).
72
73
-That means that if you do a "git-read-tree -m <newtree>" followed by a
74
-"git-checkout-index -f -u -a", the "git-checkout-index" only checks out
73
+That means that if you do a `git-read-tree -m <newtree>` followed by a
74
+`git-checkout-index -f -u -a`, the `git-checkout-index` only checks out
75
the stuff that really changed.
76
77
-This is used to avoid unnecessary false hits when "git-diff-files" is
78
-run after git-read-tree.
77
+This is used to avoid unnecessary false hits when `git-diff-files` is
78
+run after `git-read-tree`.
79
80
81
Two Tree Merge
82
~~~~~~~~~~~~~~
83
84
-Typically, this is invoked as "git-read-tree -m $H $M", where $H
84
+Typically, this is invoked as `git-read-tree -m $H $M`, where $H
85
is the head commit of the current repository, and $M is the head
86
of a foreign tree, which is simply ahead of $H (i.e. we are in a
87
fast forward situation).
@@ -94,7 +94,7 @@ the following:
94
95
2. The user wants to fast-forward to $M.
96
97
-In this case, the "git-read-tree -m $H $M" command makes sure
97
+In this case, the `git-read-tree -m $H $M` command makes sure
98
that no local change is lost as the result of this "merge".
99
Here are the "carry forward" rules:
100
@@ -141,13 +141,13 @@ operating under the -u flag.
141
142
When this form of git-read-tree returns successfully, you can
143
see what "local changes" you made are carried forward by running
144
-"git-diff-index --cached $M". Note that this does not
145
-necessarily match "git-diff-index --cached $H" would have
144
+`git-diff-index --cached $M`. Note that this does not
145
+necessarily match `git-diff-index --cached $H` would have
146
produced before such a two tree merge. This is because of cases
147
18 and 19 --- if you already had the changes in $M (e.g. maybe
148
-you picked it up via e-mail in a patch form), "git-diff-index
149
---cached $H" would have told you about the change before this
150
-merge, but it would not show in "git-diff-index --cached $M"
148
+you picked it up via e-mail in a patch form), `git-diff-index
149
+--cached $H` would have told you about the change before this
150
+merge, but it would not show in `git-diff-index --cached $M`
151
output after two-tree merge.
152
153
@@ -156,18 +156,20 @@ output after two-tree merge.
156
Each "index" entry has two bits worth of "stage" state. stage 0 is the
157
normal one, and is the only one you'd see in any kind of normal use.
158
159
-However, when you do "git-read-tree" with three trees, the "stage"
159
+However, when you do `git-read-tree` with three trees, the "stage"
160
starts out at 1.
161
162
This means that you can do
163
164
- git-read-tree -m <tree1> <tree2> <tree3>
164
+----------------
165
+$ git-read-tree -m <tree1> <tree2> <tree3>
166
+----------------
167
168
and you will end up with an index with all of the <tree1> entries in
169
"stage1", all of the <tree2> entries in "stage2" and all of the
170
<tree3> entries in "stage3".
171
170
-Furthermore, "git-read-tree" has special-case logic that says: if you see
172
+Furthermore, `git-read-tree` has special-case logic that says: if you see
173
a file that matches in all respects in the following states, it
174
"collapses" back to "stage0":
175
@@ -180,7 +182,7 @@ a file that matches in all respects in the following states, it
182
- stage 1 and stage 3 are the same and stage 2 is different take
183
stage 2 (some work has been done on stage 2)
184
183
-The "git-write-tree" command refuses to write a nonsensical tree, and it
185
+The `git-write-tree` command refuses to write a nonsensical tree, and it
186
will complain about unmerged entries if it sees a single entry that is not
187
stage 0.
188
@@ -220,8 +222,8 @@ populated. Here is an outline of how the algorithm works:
222
matching "stage1" entry if it exists too. .. all the normal
223
trivial rules ..
224
223
-You would normally use "git-merge-index" with supplied
224
-"git-merge-one-file" to do this last step. The script
225
+You would normally use `git-merge-index` with supplied
226
+`git-merge-one-file` to do this last step. The script
227
does not touch the files in the work tree, and the entire merge
228
happens in the index file. In other words, there is no need to
229
worry about what is in the working directory, since it is never
@@ -239,27 +241,33 @@ This is done to prevent you from losing your work-in-progress
241
changes. To illustrate, suppose you start from what has been
242
commited last to your repository:
243
242
- $ JC=`git-rev-parse --verify "HEAD^0"`
243
- $ git-checkout-index -f -u -a $JC
244
+----------------
245
+$ JC=`git-rev-parse --verify "HEAD^0"`
246
+$ git-checkout-index -f -u -a $JC
247
+----------------
248
249
You do random edits, without running git-update-index. And then
250
you notice that the tip of your "upstream" tree has advanced
251
since you pulled from him:
252
249
- $ git-fetch rsync://.... linus
250
- $ LT=`cat .git/MERGE_HEAD`
253
+----------------
254
+$ git-fetch rsync://.... linus
255
+$ LT=`cat .git/MERGE_HEAD`
256
+----------------
257
258
Your work tree is still based on your HEAD ($JC), but you have
259
some edits since. Three-way merge makes sure that you have not
260
added or modified index entries since $JC, and if you haven't,
261
then does the right thing. So with the following sequence:
262
257
- $ git-read-tree -m -u `git-merge-base $JC $LT` $JC $LT
258
- $ git-merge-index git-merge-one-file -a
259
- $ echo "Merge with Linus" | \
260
- git-commit-tree `git-write-tree` -p $JC -p $LT
263
+----------------
264
+$ git-read-tree -m -u `git-merge-base $JC $LT` $JC $LT
265
+$ git-merge-index git-merge-one-file -a
266
+$ echo "Merge with Linus" | \
267
+ git-commit-tree `git-write-tree` -p $JC -p $LT
268
+----------------
269
262
-what you would commit is a pure merge between $JC and LT without
270
+what you would commit is a pure merge between $JC and $LT without
271
your work-in-progress changes, and your work tree would be
272
updated to the result of the merge.
273
Documentation/git-update-index.txt
+15
-5
@@ -123,7 +123,9 @@ merging.
123
124
To pretend you have a file with mode and sha1 at path, say:
125
126
- $ git-update-index --cacheinfo mode sha1 path
126
+----------------
127
+$ git-update-index --cacheinfo mode sha1 path
128
+----------------
129
130
'--info-only' is used to register files without placing them in the object
131
database. This is useful for status-only repositories.
@@ -138,7 +140,9 @@ Examples
140
--------
141
To update and refresh only the files already checked out:
142
141
- git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
143
+----------------
144
+$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
145
+----------------
146
147
148
Configuration
@@ -146,12 +150,18 @@ Configuration
150
151
The command honors `core.filemode` configuration variable. If
152
your repository is on an filesystem whose executable bits are
149
-unreliable, this should be set to 'false'. This causes the
150
-command to ignore differences in file modes recorded in the
151
-index and the file mode on the filesystem if they differ only on
153
+unreliable, this should be set to 'false' (see gitlink:git-repo-config[1]).
154
+This causes the command to ignore differences in file modes recorded
155
+in the index and the file mode on the filesystem if they differ only on
156
executable bit. On such an unfortunate filesystem, you may
157
need to use `git-update-index --chmod=`.
158
159
+
160
+See Also
161
+--------
162
+gitlink:git-repo-config[1]
163
+
164
+
165
Author
166
------
167
Written by Linus Torvalds <torvalds@osdl.org>
Documentation/git-write-tree.txt
+8
-6
@@ -14,19 +14,21 @@ DESCRIPTION
14
-----------
15
Creates a tree object using the current index.
16
17
-The index must be merged.
17
+The index must be in a fully merged state.
18
19
-Conceptually, "git-write-tree" sync()s the current index contents
19
+Conceptually, `git-write-tree` sync()s the current index contents
20
into a set of tree files.
21
In order to have that match what is actually in your directory right
22
-now, you need to have done a "git-update-index" phase before you did the
23
-"git-write-tree".
22
+now, you need to have done a `git-update-index` phase before you did the
23
+`git-write-tree`.
24
+
25
26
OPTIONS
27
-------
28
--missing-ok::
28
- Normally "git-write-tree" ensures that the objects referenced by the
29
- directory exist in the object database. This option disables this check.
29
+ Normally `git-write-tree` ensures that the objects referenced by the
30
+ directory exist in the object database. This option disables this
31
+ check.
32
33
Author
34
------