Jonathan Nieder <jrnieder@xxxxxxxxx> writes: > [someone should have] > | suggested an alternative syntax that avoids the mistake you quoted > | above, perhaps something like: > | > | git branch --set-upstream-to=origin/master [HEAD] > > with which I disagree. You can think of it this way. "git branch" can not only _create_ a new branch (or list existing ones, but that is another entirely different mode), but also can be used to set attributes to an existing branch. Imagine a new option, say --set-description, to replace branch.frotz.description, for example. It would be used like this: $ git branch --set-description='add frotz feature' frotz to set the description for the 'frotz' branch (i.e. the above would set branch.frotz.description), and we default to HEAD if 'frotz' is missing from the command line. "git branch --option [<branch>]" is about manipulating the branch, and we default the target of manipulation to HEAD. "upstream" is just another kind of attribute for the branch being manipulated, whose value happens to be a branch name. The mistake was that --set-upstream was coded by piggybacking the existing --track implementation where a new branch was created, and in that codepath, "git branch <name1> [<name2>]" creates <name1> while defaulting a missing <name2> to HEAD. Creating a new branch that is forked from the current HEAD is an often useful thing to do, so defaulting a missing <name2> (aka "start-point") to HEAD is very sensible, but reconfiguring a named branch <name1> to integrate with the current branch is much less useful than the other way around. One major reason why it is so is because you would more likely set any branch to integrate with a remote tracking branch (rather than a local branch) and by definition your HEAD cannot be a remote tracking branch. It makes it worse that you would often want to reconfigure the current branch; for the purpose of reconfiguring a branch <name1> to integrate with something else <name2>, it is much more likely that you want a missing <name1> to default to HEAD, not the other way around to default a missing <name2> to HEAD, which is useful for branch creation. But switching which missing argument gets default based on what options are used is insane. If the very original "create this new branch starting at that point" were spelled like this $ git branch [--start-point=<name2>] <name1> and a missing <name2> defaulted to HEAD, it probably would have been better. It would have made it very unlikely to tempt anybody to hack the --set-upstream option into the system with the wrong parameter order if such a command line convention was in place. If anything, it could be a sensible longer-term direction to a more intuitive UI to deprecate the two-name format and make the creation to be specified with an explicit --start-point option with an argument (which defaults to HEAD), but I think that falls into the "if I were reinventing git without existing userbase in 2005" category and it is too late for that. -- 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