Skip to content

Commit

Permalink
fix suggested branch creation command when detaching head
Browse files Browse the repository at this point in the history
Doing:

$ git checkout HEAD^

Generates the following message:

|warning: you are not on ANY branch anymore.
|If you meant to create a new branch from the commit, you need -b to
|associate a new branch with the wanted checkout.  Example:
|  git checkout -b <new_branch_name> HEAD^

Of course if the user does as told at this point the created branch
won't be located at the expected commit.  Reword this message a bit to
avoid such confusion.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed Jan 27, 2007
1 parent d848804 commit eb3204d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions git-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ then
if test -n "$oldbranch"
then
detach_warn="warning: you are not on ANY branch anymore.
If you meant to create a new branch from the commit, you need -b to
associate a new branch with the wanted checkout. Example:
git checkout -b <new_branch_name> $arg"
If you meant to create a new branch from this checkout, you may still do
so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new_branch_name>"
fi
elif test -z "$oldbranch" && test -n "$branch"
then
Expand Down

0 comments on commit eb3204d

Please sign in to comment.