DWIM "git checkout frotz" to "git checkout -b frotz origin/frotz"
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- Jun 5, 2010, 11:09 UTC
- Message-ID
- <20100605110930.GA10526@localhost>
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