On 25 September 2013 21:12, Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> wrote: > Jona Christopher Sahnwaldt <jc@xxxxxxxxxxxx> writes: > >> Hi everyone, >> >> tl;dr: The short form "git checkout foo" is a mess. There's simply too >> much "DWIM" magic going on. There are no comprehensible rules how it >> decides if "foo" is a pathspec or a refspec. > > There is a very simple rule: > > What's on the left hand side of -- are refs, what's on the right hand > side are paths. > > When you don't use --, then Git tries to guess, and fails whenever > there's an ambiguity. That's the case I'm concerned with. And I think the guessing confuses users in many cases. It certainly has confused me. > >>> OK, what happens is that "git checkout wiktionary" is actually a >>> shorthand for "git checkout -b wiktionary --track origin/wiktionary". >> >> No, it isn't. > > What I meant was that the short form advised by people were _meant_ to > be a shorthand. > >> Let's consider several scenarios: > > I don't get your point. Is the overly long list a way of complaining? It's a way of showing that human beings can't understand git's guesswork. :-) It was also a (failed) attempt to understand the rules of this heuristic. And an attempt to show the developers that the rules have gotten out of hand. > Are you suggesting a change? Yes, I think the rules for the "short form" (the guessing when there's no --) should be made simpler, or maybe the guessing should be dropped altogether. I don't know. I don't know git well enough to be able to be more specific. I just find the current behavior very confusing. > What do you think about the change I'm proposing? I don't know. It looks like it's not really addressing my specific problem, because as far as I understand it only applies when there is a --. But again, I don't know git well enough. Anyway, thanks for your work. I'm sorry I can't provide more useful input. This "short form" of checkout is just a small feature. I guess I'm bikeshedding here. Cheers, JC > > -- > Matthieu Moy > http://www-verimag.imag.fr/~moy/ -- 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