The commit message of 75d6e552a (Documentation: @{-N} can refer to a commit, 2014-01-19) clearly specifies how @{-N} can be used to refer not only to a branch but also to a commit. IOW, @{-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. Correct the misleading sentence which states that @{-N} doesn't detach HEAD. Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@xxxxxxxxx> --- Documentation/git-checkout.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index e108b0f74..238880f10 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -272,9 +272,8 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode. commit, your HEAD becomes "detached" and you are no longer on any branch (see below for details). + -As a special case, the `"@{-N}"` syntax for the N-th last branch/commit -checks out branches (instead of detaching). You may also specify -`-` which is synonymous with `"@{-1}"`. +As a special case, the `@{-N}` syntax checks out the N-th last branch/commit(checkout). +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 -- 2.15.0.291.g0d8980c5d