@matheusbsbs / matheus-bagliano / commits / 0808723b50
Fork 0

docs/checkout: clarify what "non-branch" means

In the code we literally stick "refs/heads/" on the front and see if it resolves, so that is probably the best explanation. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Apr 13, 2009 at 07:21 UTC 0808723b5065cc2141c2715a2df78882c158d4ef
1 file changed +5 -5
Documentation/git-checkout.txt
+5 -5
@@ -114,11 +114,11 @@ the conflicted merge in the specified paths.
114 "merge" style, shows the original contents).
115
116 <branch>::
117 - Branch to checkout (when no paths are given); may be any object
118 - ID that resolves to a commit. Defaults to HEAD.
119 -+
120 -When this parameter names a non-branch (but still a valid commit object),
121 -your HEAD becomes 'detached'.
117 + Branch to checkout; if it refers to a branch (i.e., a name that,
118 + when prepended with "refs/heads/", is a valid ref), then that
119 + branch is checked out. Otherwise, if it refers to a valid
120 + commit, your HEAD becomes "detached" and you are no longer on
121 + any branch (see below for details).
122 +
123 As a special case, the `"@\{-N\}"` syntax for the N-th last branch
124 checks out the branch (instead of detaching). You may also specify