git-checkout.txt: fix monospace typeset
Add backticks where we have none, replace single quotes with backticks and replace double-quotes. Drop double-quotes from nested constructions such as `"@{-1}"`. Helped-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 29, 2019 at 17:38 UTC
181e3725ecd12f5477d8581515fdbeb2469df1e7
1 file changed
+81
-81
Documentation/git-checkout.txt
+81
-81
@@ -24,14 +24,14 @@ also update `HEAD` to set the specified branch as the current
24
branch.
25
26
'git checkout' [<branch>]::
27
- To prepare for working on <branch>, switch to it by updating
27
+ To prepare for working on `<branch>`, switch to it by updating
28
the index and the files in the working tree, and by pointing
29
- HEAD at the branch. Local modifications to the files in the
29
+ `HEAD` at the branch. Local modifications to the files in the
30
working tree are kept, so that they can be committed to the
31
- <branch>.
31
+ `<branch>`.
32
+
33
-If <branch> is not found but there does exist a tracking branch in
34
-exactly one remote (call it <remote>) with a matching name, treat as
33
+If `<branch>` is not found but there does exist a tracking branch in
34
+exactly one remote (call it `<remote>`) with a matching name, treat as
35
equivalent to
36
+
37
------------
@@ -47,7 +47,7 @@ branches from there if `<branch>` is ambiguous but exists on the
47
'origin' remote. See also `checkout.defaultRemote` in
48
linkgit:git-config[1].
49
+
50
-You could omit <branch>, in which case the command degenerates to
50
+You could omit `<branch>`, in which case the command degenerates to
51
"check out the current branch", which is a glorified no-op with
52
rather expensive side-effects to show only the tracking information,
53
if exists, for the current branch.
@@ -61,7 +61,7 @@ if exists, for the current branch.
61
`--track` without `-b` implies branch creation; see the
62
description of `--track` below.
63
+
64
-If `-B` is given, <new_branch> is created if it doesn't exist; otherwise, it
64
+If `-B` is given, `<new_branch>` is created if it doesn't exist; otherwise, it
65
is reset. This is the transactional equivalent of
66
+
67
------------
@@ -75,25 +75,25 @@ successful.
75
'git checkout' --detach [<branch>]::
76
'git checkout' [--detach] <commit>::
77
78
- Prepare to work on top of <commit>, by detaching HEAD at it
78
+ Prepare to work on top of `<commit>`, by detaching `HEAD` at it
79
(see "DETACHED HEAD" section), and updating the index and the
80
files in the working tree. Local modifications to the files
81
in the working tree are kept, so that the resulting working
82
tree will be the state recorded in the commit plus the local
83
modifications.
84
+
85
-When the <commit> argument is a branch name, the `--detach` option can
86
-be used to detach HEAD at the tip of the branch (`git checkout
87
-<branch>` would check out that branch without detaching HEAD).
85
+When the `<commit>` argument is a branch name, the `--detach` option can
86
+be used to detach `HEAD` at the tip of the branch (`git checkout
87
+<branch>` would check out that branch without detaching `HEAD`).
88
+
89
-Omitting <branch> detaches HEAD at the tip of the current branch.
89
+Omitting `<branch>` detaches `HEAD` at the tip of the current branch.
90
91
'git checkout' [<tree-ish>] [--] <pathspec>...::
92
93
Overwrite paths in the working tree by replacing with the
94
- contents in the index or in the <tree-ish> (most often a
95
- commit). When a <tree-ish> is given, the paths that
96
- match the <pathspec> are updated both in the index and in
94
+ contents in the index or in the `<tree-ish>` (most often a
95
+ commit). When a `<tree-ish>` is given, the paths that
96
+ match the `<pathspec>` are updated both in the index and in
97
the working tree.
98
+
99
The index may contain unmerged entries because of a previous failed merge.
@@ -128,7 +128,7 @@ OPTIONS
128
-f::
129
--force::
130
When switching branches, proceed even if the index or the
131
- working tree differs from HEAD. This is used to throw away
131
+ working tree differs from `HEAD`. This is used to throw away
132
local changes.
133
+
134
When checking out paths from the index, do not fail upon unmerged
@@ -155,12 +155,12 @@ on your side branch as `theirs` (i.e. "one contributor's work on top
155
of it").
156
157
-b <new_branch>::
158
- Create a new branch named <new_branch> and start it at
159
- <start_point>; see linkgit:git-branch[1] for details.
158
+ Create a new branch named `<new_branch>` and start it at
159
+ `<start_point>`; see linkgit:git-branch[1] for details.
160
161
-B <new_branch>::
162
- Creates the branch <new_branch> and start it at <start_point>;
163
- if it already exists, then reset it to <start_point>. This is
162
+ Creates the branch `<new_branch>` and start it at `<start_point>`;
163
+ if it already exists, then reset it to `<start_point>`. This is
164
equivalent to running "git branch" with "-f"; see
165
linkgit:git-branch[1] for details.
166
@@ -173,15 +173,15 @@ If no `-b` option is given, the name of the new branch will be
173
derived from the remote-tracking branch, by looking at the local part of
174
the refspec configured for the corresponding remote, and then stripping
175
the initial part up to the "*".
176
-This would tell us to use "hack" as the local branch when branching
177
-off of "origin/hack" (or "remotes/origin/hack", or even
178
-"refs/remotes/origin/hack"). If the given name has no slash, or the above
176
+This would tell us to use `hack` as the local branch when branching
177
+off of `origin/hack` (or `remotes/origin/hack`, or even
178
+`refs/remotes/origin/hack`). If the given name has no slash, or the above
179
guessing results in an empty name, the guessing is aborted. You can
180
explicitly give a name with `-b` in such a case.
181
182
--no-track::
183
Do not set up "upstream" configuration, even if the
184
- branch.autoSetupMerge configuration variable is true.
184
+ `branch.autoSetupMerge` configuration variable is true.
185
186
-l::
187
Create the new branch's reflog; see linkgit:git-branch[1] for
@@ -190,21 +190,21 @@ explicitly give a name with `-b` in such a case.
190
--detach::
191
Rather than checking out a branch to work on it, check out a
192
commit for inspection and discardable experiments.
193
- This is the default behavior of "git checkout <commit>" when
194
- <commit> is not a branch name. See the "DETACHED HEAD" section
193
+ This is the default behavior of `git checkout <commit>` when
194
+ `<commit>` is not a branch name. See the "DETACHED HEAD" section
195
below for details.
196
197
--orphan <new_branch>::
198
- Create a new 'orphan' branch, named <new_branch>, started from
199
- <start_point> and switch to it. The first commit made on this
198
+ Create a new 'orphan' branch, named `<new_branch>`, started from
199
+ `<start_point>` and switch to it. The first commit made on this
200
new branch will have no parents and it will be the root of a new
201
history totally disconnected from all the other branches and
202
commits.
203
+
204
The index and the working tree are adjusted as if you had previously run
205
-"git checkout <start_point>". This allows you to start a new history
206
-that records a set of paths similar to <start_point> by easily running
207
-"git commit -a" to make the root commit.
205
+`git checkout <start_point>`. This allows you to start a new history
206
+that records a set of paths similar to `<start_point>` by easily running
207
+`git commit -a` to make the root commit.
208
+
209
This can be useful when you want to publish the tree from a commit
210
without exposing its full history. You might want to do this to publish
@@ -213,17 +213,17 @@ whose full history contains proprietary or otherwise encumbered bits of
213
code.
214
+
215
If you want to start a disconnected history that records a set of paths
216
-that is totally different from the one of <start_point>, then you should
216
+that is totally different from the one of `<start_point>`, then you should
217
clear the index and the working tree right after creating the orphan
218
-branch by running "git rm -rf ." from the top level of the working tree.
218
+branch by running `git rm -rf .` from the top level of the working tree.
219
Afterwards you will be ready to prepare your new files, repopulating the
220
working tree, by copying them from elsewhere, extracting a tarball, etc.
221
222
--ignore-skip-worktree-bits::
223
In sparse checkout mode, `git checkout -- <paths>` would
224
- update only entries matched by <paths> and sparse patterns
225
- in $GIT_DIR/info/sparse-checkout. This option ignores
226
- the sparse patterns and adds back any files in <paths>.
224
+ update only entries matched by `<paths>` and sparse patterns
225
+ in `$GIT_DIR/info/sparse-checkout`. This option ignores
226
+ the sparse patterns and adds back any files in `<paths>`.
227
228
-m::
229
--merge::
@@ -245,18 +245,18 @@ When checking out paths from the index, this option lets you recreate
245
the conflicted merge in the specified paths.
246
247
--conflict=<style>::
248
- The same as --merge option above, but changes the way the
248
+ The same as `--merge` option above, but changes the way the
249
conflicting hunks are presented, overriding the
250
- merge.conflictStyle configuration variable. Possible values are
250
+ `merge.conflictStyle` configuration variable. Possible values are
251
"merge" (default) and "diff3" (in addition to what is shown by
252
"merge" style, shows the original contents).
253
254
-p::
255
--patch::
256
Interactively select hunks in the difference between the
257
- <tree-ish> (or the index, if unspecified) and the working
257
+ `<tree-ish>` (or the index, if unspecified) and the working
258
tree. The chosen hunks are then applied in reverse to the
259
- working tree (and if a <tree-ish> was specified, the index).
259
+ working tree (and if a `<tree-ish>` was specified, the index).
260
+
261
This means that you can use `git checkout -p` to selectively discard
262
edits from your current working tree. See the ``Interactive Mode''
@@ -279,13 +279,13 @@ Note that this option uses the no overlay mode by default (see also
279
280
--recurse-submodules::
281
--no-recurse-submodules::
282
- Using --recurse-submodules will update the content of all initialized
282
+ Using `--recurse-submodules` will update the content of all initialized
283
submodules according to the commit recorded in the superproject. If
284
local modifications in a submodule would be overwritten the checkout
285
- will fail unless `-f` is used. If nothing (or --no-recurse-submodules)
285
+ will fail unless `-f` is used. If nothing (or `--no-recurse-submodules`)
286
is used, the work trees of submodules will not be updated.
287
- Just like linkgit:git-submodule[1], this will detach the
288
- submodules HEAD.
287
+ Just like linkgit:git-submodule[1], this will detach `HEAD` of the
288
+ submodule.
289
290
--no-guess::
291
Do not attempt to create a branch if a remote tracking branch
@@ -296,21 +296,21 @@ Note that this option uses the no overlay mode by default (see also
296
In the default overlay mode, `git checkout` never
297
removes files from the index or the working tree. When
298
specifying `--no-overlay`, files that appear in the index and
299
- working tree, but not in <tree-ish> are removed, to make them
300
- match <tree-ish> exactly.
299
+ working tree, but not in `<tree-ish>` are removed, to make them
300
+ match `<tree-ish>` exactly.
301
302
<branch>::
303
Branch to checkout; if it refers to a branch (i.e., a name that,
304
when prepended with "refs/heads/", is a valid ref), then that
305
branch is checked out. Otherwise, if it refers to a valid
306
- commit, your HEAD becomes "detached" and you are no longer on
306
+ commit, your `HEAD` becomes "detached" and you are no longer on
307
any branch (see below for details).
308
+
309
-You can use the `"@{-N}"` syntax to refer to the N-th last
309
+You can use the `@{-N}` syntax to refer to the N-th last
310
branch/commit checked out using "git checkout" operation. You may
311
-also specify `-` which is synonymous to `"@{-1}"`.
311
+also specify `-` which is synonymous to `@{-1}`.
312
+
313
-As a special case, you may use `"A...B"` as a shortcut for the
313
+As a special case, you may use `A...B` as a shortcut for the
314
merge base of `A` and `B` if there is exactly one merge base. You can
315
leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
316
@@ -319,7 +319,7 @@ leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
319
320
<start_point>::
321
The name of a commit at which to start the new branch; see
322
- linkgit:git-branch[1] for details. Defaults to HEAD.
322
+ linkgit:git-branch[1] for details. Defaults to `HEAD`.
323
324
<tree-ish>::
325
Tree to checkout from (when paths are given). If not specified,
@@ -329,9 +329,9 @@ leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
329
330
DETACHED HEAD
331
-------------
332
-HEAD normally refers to a named branch (e.g. 'master'). Meanwhile, each
332
+`HEAD` normally refers to a named branch (e.g. `master`). Meanwhile, each
333
branch refers to a specific commit. Let's look at a repo with three
334
-commits, one of them tagged, and with branch 'master' checked out:
334
+commits, one of them tagged, and with branch `master` checked out:
335
336
------------
337
HEAD (refers to branch 'master')
@@ -344,10 +344,10 @@ a---b---c branch 'master' (refers to commit 'c')
344
------------
345
346
When a commit is created in this state, the branch is updated to refer to
347
-the new commit. Specifically, 'git commit' creates a new commit 'd', whose
348
-parent is commit 'c', and then updates branch 'master' to refer to new
349
-commit 'd'. HEAD still refers to branch 'master' and so indirectly now refers
350
-to commit 'd':
347
+the new commit. Specifically, 'git commit' creates a new commit `d`, whose
348
+parent is commit `c`, and then updates branch `master` to refer to new
349
+commit `d`. `HEAD` still refers to branch `master` and so indirectly now refers
350
+to commit `d`:
351
352
------------
353
$ edit; git add; git commit
@@ -364,7 +364,7 @@ a---b---c---d branch 'master' (refers to commit 'd')
364
It is sometimes useful to be able to checkout a commit that is not at
365
the tip of any named branch, or even to create a new commit that is not
366
referenced by a named branch. Let's look at what happens when we
367
-checkout commit 'b' (here we show two ways this may be done):
367
+checkout commit `b` (here we show two ways this may be done):
368
369
------------
370
$ git checkout v2.0 # or
@@ -379,9 +379,9 @@ a---b---c---d branch 'master' (refers to commit 'd')
379
tag 'v2.0' (refers to commit 'b')
380
------------
381
382
-Notice that regardless of which checkout command we use, HEAD now refers
383
-directly to commit 'b'. This is known as being in detached HEAD state.
384
-It means simply that HEAD refers to a specific commit, as opposed to
382
+Notice that regardless of which checkout command we use, `HEAD` now refers
383
+directly to commit `b`. This is known as being in detached `HEAD` state.
384
+It means simply that `HEAD` refers to a specific commit, as opposed to
385
referring to a named branch. Let's see what happens when we create a commit:
386
387
------------
@@ -398,7 +398,7 @@ a---b---c---d branch 'master' (refers to commit 'd')
398
tag 'v2.0' (refers to commit 'b')
399
------------
400
401
-There is now a new commit 'e', but it is referenced only by HEAD. We can
401
+There is now a new commit `e`, but it is referenced only by `HEAD`. We can
402
of course add yet another commit in this state:
403
404
------------
@@ -416,7 +416,7 @@ a---b---c---d branch 'master' (refers to commit 'd')
416
------------
417
418
In fact, we can perform all the normal Git operations. But, let's look
419
-at what happens when we then checkout master:
419
+at what happens when we then checkout `master`:
420
421
------------
422
$ git checkout master
@@ -431,9 +431,9 @@ a---b---c---d branch 'master' (refers to commit 'd')
431
------------
432
433
It is important to realize that at this point nothing refers to commit
434
-'f'. Eventually commit 'f' (and by extension commit 'e') will be deleted
434
+`f`. Eventually commit `f` (and by extension commit `e`) will be deleted
435
by the routine Git garbage collection process, unless we create a reference
436
-before that happens. If we have not yet moved away from commit 'f',
436
+before that happens. If we have not yet moved away from commit `f`,
437
any of these will create a reference to it:
438
439
------------
@@ -442,19 +442,19 @@ $ git branch foo <2>
442
$ git tag foo <3>
443
------------
444
445
-<1> creates a new branch 'foo', which refers to commit 'f', and then
446
- updates HEAD to refer to branch 'foo'. In other words, we'll no longer
447
- be in detached HEAD state after this command.
445
+<1> creates a new branch `foo`, which refers to commit `f`, and then
446
+ updates `HEAD` to refer to branch `foo`. In other words, we'll no longer
447
+ be in detached `HEAD` state after this command.
448
449
-<2> similarly creates a new branch 'foo', which refers to commit 'f',
450
- but leaves HEAD detached.
449
+<2> similarly creates a new branch `foo`, which refers to commit `f`,
450
+ but leaves `HEAD` detached.
451
452
-<3> creates a new tag 'foo', which refers to commit 'f',
453
- leaving HEAD detached.
452
+<3> creates a new tag `foo`, which refers to commit `f`,
453
+ leaving `HEAD` detached.
454
455
-If we have moved away from commit 'f', then we must first recover its object
455
+If we have moved away from commit `f`, then we must first recover its object
456
name (typically by using git reflog), and then we can create a reference to
457
-it. For example, to see the last two commits to which HEAD referred, we
457
+it. For example, to see the last two commits to which `HEAD` referred, we
458
can use either of these commands:
459
460
------------
@@ -465,12 +465,12 @@ $ git log -g -2 HEAD
465
ARGUMENT DISAMBIGUATION
466
-----------------------
467
468
-When there is only one argument given and it is not `--` (e.g. "git
469
-checkout abc"), and when the argument is both a valid `<tree-ish>`
470
-(e.g. a branch "abc" exists) and a valid `<pathspec>` (e.g. a file
468
+When there is only one argument given and it is not `--` (e.g. `git
469
+checkout abc`), and when the argument is both a valid `<tree-ish>`
470
+(e.g. a branch `abc` exists) and a valid `<pathspec>` (e.g. a file
471
or a directory whose name is "abc" exists), Git would usually ask
472
you to disambiguate. Because checking out a branch is so common an
473
-operation, however, "git checkout abc" takes "abc" as a `<tree-ish>`
473
+operation, however, `git checkout abc` takes "abc" as a `<tree-ish>`
474
in such a situation. Use `git checkout -- <pathspec>` if you want
475
to checkout these paths out of the index.
476
@@ -478,7 +478,7 @@ EXAMPLES
478
--------
479
480
. The following sequence checks out the `master` branch, reverts
481
- the `Makefile` to two revisions back, deletes hello.c by
481
+ the `Makefile` to two revisions back, deletes `hello.c` by
482
mistake, and gets it back from the index.
483
+
484
------------
@@ -490,7 +490,7 @@ $ git checkout hello.c <3>
490
+
491
<1> switch branch
492
<2> take a file out of another commit
493
-<3> restore hello.c from the index
493
+<3> restore `hello.c` from the index
494
+
495
If you want to check out _all_ C source files out of the index,
496
you can say
@@ -519,7 +519,7 @@ $ git checkout -- hello.c
519
$ git checkout mytopic
520
------------
521
+
522
-However, your "wrong" branch and correct "mytopic" branch may
522
+However, your "wrong" branch and correct `mytopic` branch may
523
differ in files that you have modified locally, in which case
524
the above checkout would fail like this:
525
+