I still can’t get over how obtuse and error-prone git’s command line UI is.
Today I was trying really hard to checkout a tag of some project to try and fix a bug.
Are there tags ? Why, yes.
$ git tag -l
Here are my attempts and its responses:
$ git checkout redland_bindings_1_0_7_1
error: pathspec 'redland_bindings_1_0_7_1' did not match any file(s) known to git.
$ git checkout -b redland_bindings_1_0_7_1 redland_bindings_1_0_7_1
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'redland_bindings_1_0_7_1' which can not be resolved as commit?
Can you spot my error ? It took me a good thirty minutes to figure out what exactly I was doing wrong. Git could have just told me. Suggestions to improve these obtuse error messages?
The first error suggests that git thinks I’m trying to check out a file. Strangely enough git checkout -h says:
usage: git checkout [options] <branch>
or: git checkout [options] [<branch>] -- <file> ...
so why does it even think I’m trying to check out a file ? The usage suggests the only way to check out a file is to list them after — which I didn’t specify. Isn’t the more logical thing to assume I was trying to check out a branch ? And while on the subject, you have to somehow understand or assume that, even though a tag is not a branch, you can actually check out a tag this way.
Instead the error should probably say something like:
git doesn't know about a branch or tag named '...'
Check with git tag -l or git branch -a to see all tags and branches.
If you wanted to specify a file instead, use -- to separate branch or tag from file names.
Now the second one. I am sorry git that I crossed the flux capacitators to reverse the coagulation of the ninth-dimensional positrons. But could you please try and insult me in English ? All I can get from this message, *after* understanding what my problem was, is that you think I want to switch branches (is that the same as checking out a tag ? Maybe, how can I tell ?) at the same time as updating a path. I’m pretty sure I’m only trying to do one of those two things, although I’m not too sure. And I think the proper English for that second sentence would be something like
"Did you intend to checkout the tag or branch '...', which does not exist in the repository ?
Use git tag -l or git branch -a to see a list of tags and branches.
I can’t *wait* for the comments to pour in telling me I’m stupid because I can’t automatically read ‘cannot be resolved as a commit’ is gitese for ‘the tag does not exist’.
I’m only writing this post because git in this particular instance caused me to waste less time than average with obtuse UI, so I had some time to spare to complain.