On Thu, Jun 24, 2010 at 2:36 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Tay Ray Chuan <rctay89@xxxxxxxxx> writes: > >> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt >> index 261dd90..5849e13 100644 >> --- a/Documentation/git-checkout.txt >> +++ b/Documentation/git-checkout.txt >> @@ -31,6 +31,13 @@ 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. >> ++ >> +If `-B` is given, <branch> is created if it doesn't exist; otherwise, it >> +is reset. This is equivalent to >> ++ >> +------------ >> +$ git branch -f <branch> [<start point>] && git checkout <branch> >> +------------ > > It is somewhat sad if these are truly equivalent. In the above sequence, > "git checkout <branch>" could stop to prevent you from clobbering your > local changes, but at that point the branch has already been updated. > > I was hoping that the check (and stop) can be done first and then the > branch head is cloberred after you know you will succeed the checkout. hmm - would git checkout <branch> && git reset --keep <start point> make the cut? -- Cheers, Ray Chuan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html