From: Junio C Hamano Date: Tue, 22 Jun 2010 16:31:47 +0000 (-0700) Subject: Merge branch 'jn/checkout-doc' into maint X-Git-Tag: v1.7.2-rc0~18^2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/12575b78fbc6db9eb8de12c8146c7d27eb821e09?ds=inline;hp=-c Merge branch 'jn/checkout-doc' into maint * jn/checkout-doc: Documentation/checkout: clarify description Documentation/checkout: clarify description --- 12575b78fbc6db9eb8de12c8146c7d27eb821e09 diff --combined Documentation/git-checkout.txt index a3a87fa7fd,69cf917840..7146288ad6 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@@ -15,33 -15,41 +15,41 @@@ SYNOPSI DESCRIPTION ----------- - - When are not given, this command switches branches by - updating the index, working tree, and HEAD to reflect the specified + Updates files in the working tree to match the version in the index + or the specified tree. If no paths are given, 'git checkout' will + also update `HEAD` to set the specified branch as the current branch. - If `-b` is given, a new branch is created and checked out, as if - linkgit:git-branch[1] were called; in this case you can - use the --track or --no-track options, which will be passed to `git - branch`. As a convenience, --track without `-b` implies branch - creation; see the description of --track below. - - When or --patch are given, this command does *not* switch - branches. It updates the named paths in the working tree from - the index file, or from a named (most often a commit). In - this case, the `-b` and `--track` options are meaningless and giving - either of them results in an error. The 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 after a failed merge. By - default, if you try to check out such an entry from the index, the + 'git checkout' []:: + 'git checkout' -b []:: + + This form switches branches by updating the index, working + tree, and HEAD to reflect the specified branch. + + + If `-b` is given, a new branch is created as if linkgit:git-branch[1] + were called and then checked out; in this case you can + use the `--track` or `--no-track` options, which will be passed to + 'git branch'. As a convenience, `--track` without `-b` implies branch + creation; see the description of `--track` below. + + 'git checkout' [--patch] [] [--] ...:: + + When or `--patch` are given, 'git checkout' *not* switch + branches. It updates the named paths in the working tree from + the index file or from a named (most often a commit). In + this case, the `-b` and `--track` options are meaningless and giving + either of them results in an error. The 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. - 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 - using --ours or --theirs. With -m, changes made to the working tree - file can be discarded to recreate the original conflicted merge result. + using `--ours` or `--theirs`. With `-m`, changes made to the working tree + file can be discarded to re-create the original conflicted merge result. OPTIONS ------- @@@ -136,10 -144,6 +144,10 @@@ edits from your current working tree As a special case, the `"@\{-N\}"` syntax for the N-th last branch checks out the branch (instead of detaching). You may also specify `-` which is synonymous with `"@\{-1\}"`. ++ +As a further special case, you may use `"A...B"` as a shortcut for the +merge base of `A` and `B` if there is exactly one merge base. You can +leave out at most one of `A` and `B`, in which case it defaults to `HEAD`. :: Name for the new branch.