Browse Source

Merge branch 'jn/checkout-doc'

* jn/checkout-doc:
  Documentation/checkout: clarify description
  Documentation/checkout: clarify description
maint
Junio C Hamano 15 years ago
parent
commit
f28f04923e
  1. 54
      Documentation/git-checkout.txt

54
Documentation/git-checkout.txt

@ -15,33 +15,41 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------

Updates files in the working tree to match the version in the index
When <paths> are not given, this command switches branches by or the specified tree. If no paths are given, 'git checkout' will
updating the index, working tree, and HEAD to reflect the specified also update `HEAD` to set the specified branch as the current
branch. branch.


If `-b` is given, a new branch is created and checked out, as if 'git checkout' [<branch>]::
linkgit:git-branch[1] were called; in this case you can 'git checkout' -b <new branch> [<start point>]::
use the --track or --no-track options, which will be passed to `git
branch`. As a convenience, --track without `-b` implies branch This form switches branches by updating the index, working
creation; see the description of --track below. tree, and HEAD to reflect the specified branch.

+
When <paths> or --patch are given, this command does *not* switch If `-b` is given, a new branch is created as if linkgit:git-branch[1]
branches. It updates the named paths in the working tree from were called and then checked out; in this case you can
the index file, or from a named <tree-ish> (most often a commit). In use the `--track` or `--no-track` options, which will be passed to
this case, the `-b` and `--track` options are meaningless and giving 'git branch'. As a convenience, `--track` without `-b` implies branch
either of them results in an error. The <tree-ish> argument can be creation; see the description of `--track` below.
used to specify a specific tree-ish (i.e. commit, tag or tree)
to update the index for the given paths before updating the 'git checkout' [--patch] [<tree-ish>] [--] <pathspec>...::
working tree.

When <paths> or `--patch` are given, 'git checkout' *not* switch
The index may contain unmerged entries after a failed merge. By branches. It updates the named paths in the working tree from
default, if you try to check out such an entry from the index, the the index file or from a named <tree-ish> (most often a commit). In
this case, the `-b` and `--track` options are meaningless and giving
either of them results in an error. The <tree-ish> argument can be
used to specify a specific tree-ish (i.e. commit, tag or tree)
to update the index for the given paths before updating the
working tree.
+
The index may contain unmerged entries because of a previous failed merge.
By default, if you try to check out such an entry from the index, the
checkout operation will fail and nothing will be checked out. checkout operation will fail and nothing will be checked out.
Using -f will ignore these unmerged entries. The contents from a Using `-f` will ignore these unmerged entries. The contents from a
specific side of the merge can be checked out of the index by specific side of the merge can be checked out of the index by
using --ours or --theirs. With -m, changes made to the working tree using `--ours` or `--theirs`. With `-m`, changes made to the working tree
file can be discarded to recreate the original conflicted merge result. file can be discarded to re-create the original conflicted merge result.


OPTIONS OPTIONS
------- -------

Loading…
Cancel
Save