From: Junio C Hamano Date: Wed, 23 Jun 2010 18:36:06 GMT Subject: Re: [PATCH 3/3] builtin/checkout: learn -B Message-ID: <7vr5jxegvd.fsf@alter.siamese.dyndns.org> In-Reply-To: <1277140782-4064-4-git-send-email-rctay89@gmail.com> Tay Ray Chuan 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, is created if it doesn't exist; otherwise, it > +is reset. This is equivalent to > ++ > +------------ > +$ git branch -f [] && git checkout > +------------ It is somewhat sad if these are truly equivalent. In the above sequence, "git checkout " 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.