Re: [PATCH 3/5] checkout --to: no auto-detach if the ref is already checked out

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

 



On Wed, Jul 23, 2014 at 8:48 PM, Michael J Gruber
<git@xxxxxxxxxxxxxxxxxxxx> wrote:
> Nguyễn Thái Ngọc Duy venit, vidit, dixit 23.07.2014 13:43:
>> +     if (advice_checkout_to)
>> +             die(_("%s is already checked out at %s.\n"
>> +                   "Either use --detach or -b together with --to "
>> +                   "or switch branch in the the other checkout."),
>
> "or switch to a different branch in the other checkout". But maybe we
> can be even more helpful, like:
>
> "%s is already checked out at %s.\n"
> "Either checkout the detached head of branch %s using\n"
> "    git checkout --detach --to %s %s\n"
> "or checkout a new branch based off %s using\n"
> "    git checkout --to %s -b %s newbranch %s\n"
> "or switch to a different branch in the other checkout."
>
> if we can figure out the appropriate arguments at this point in the code.

We would not be able to construct the exact command that the user has
entered, so perhaps

  git checkout --detach <more options> %s
  git checkout -b <new branch> <more options> %s

?

Note that this does not only occur when --to is given. If you have two
checkouts associated to the same repo, "git checkout foo" on one
checkout when "foo" is held by another checkout would cause the same
error. I'll need to think of a better name than advice.checkoutTo.
-- 
Duy
--
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]