From: Tay Ray Chuan Date: Wed, 23 Jun 2010 19:13:25 GMT Subject: Re: [PATCH 3/3] builtin/checkout: learn -B Message-ID: In-Reply-To: <7vr5jxegvd.fsf@alter.siamese.dyndns.org> On Thu, Jun 24, 2010 at 2:36 AM, Junio C Hamano wrote: > 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. hmm - would git checkout && git reset --keep make the cut? -- Cheers, Ray Chuan