Skip to content

Commit 75ce149

Browse files
sivaraamgitster
authored andcommitted
Doc/checkout: checking out using @{-N} can lead to detached state
@{-N} is a syntax for the N-th last "checkout" and not the N-th last "branch". Therefore, in some cases using `git checkout @{-$N}` DOES lead to a "detached HEAD" state. This can also be ensured by the commit message of 75d6e55 (Documentation: @{-N} can refer to a commit, 2014-01-19) which clearly specifies how @{-N} can be used to refer not only to a branch but also to a commit. Correct the misleading sentence which states that @{-N} doesn't detach HEAD. Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9752ad0 commit 75ce149

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Documentation/git-checkout.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,11 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
263263
commit, your HEAD becomes "detached" and you are no longer on
264264
any branch (see below for details).
265265
+
266-
As a special case, the `"@{-N}"` syntax for the N-th last branch/commit
267-
checks out branches (instead of detaching). You may also specify
268-
`-` which is synonymous with `"@{-1}"`.
266+
You can use the `"@{-N}"` syntax to refer to the N-th last
267+
branch/commit checked out using "git checkout" operation. You may
268+
also specify `-` which is synonymous to `"@{-1}`.
269269
+
270-
As a further special case, you may use `"A...B"` as a shortcut for the
270+
As a special case, you may use `"A...B"` as a shortcut for the
271271
merge base of `A` and `B` if there is exactly one merge base. You can
272272
leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
273273

0 commit comments

Comments
 (0)