Re: [PATCH 3/3] builtin/checkout: learn -B

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]