DWIM "git checkout frotz" to "git checkout -b frotz origin/frotz"

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

 



Hi,

Peter and I just stumbled on the following interpretations of the
checkout command.

 git checkout origin/frotz      -> detaches HEAD
 git checkout -t origin/frotz   -> git checkout -b frotz origin/frotz
 git checkout frotz             -> git checkout -b frotz origin/frotz
 git checkout -t frotz          -> fatal: Missing branch name

I was surprised by the third one, which I was expecting to fail.
Apparently it's a DWIM feature introduced in commit 70c9ac2f. I
doubt that is what the user was trying to do if they ran that
command. If anything, this behavior will serve to confuse them.

I think git checkout -t <remote>/<branch> is short enough for
creating a new tracking branch. For something even shorter, we can
create an alias. But I'd prefer to keep the already complex
checkout command a little simpler.

Regards,
Clemens
--
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]