Re: branch --set-upstream considered harmful
From: Jay Soffian <hidden>
Date: 2016-06-15 22:48:55
On Mon, Jun 7, 2010 at 1:10 AM, Tay Ray Chuan [off-list ref] wrote:
quoted
(topic)$ git branch --set-upstream origin/masterHmm, I can see where the confusion is coming from - you're treating git-branch as a "branch modifier", when it really is a "branch creator" - unless you use -f, of course.
Given --set-upstream's implementation and documentation, I assume it
is primarily intended to be used with an existing branch:
--set-upstream
If specified branch does not exist yet or if --force has been
given, acts exactly like --track. Otherwise sets up configuration
like --track would when creating the branch, except that where
branch points to is not changed.
If it isn't, then there's no way to do what it does other than two
magical git config commands.
quoted
(topic)$ git branch --set-upstream=origin/master Branch topic set up to track remote branch master from origin.I was under the impression that long-style options took "=".
Git is inconsistent. Some do, some don't. But --set-upstream is currently an argumentless switch. If I were to proceed as I suggested, it would be both an argumentless switch and an option which takes an argument. That means these would be equivalent: $ git branch --set-upstream=origin/master master $ git branch --set-upstream master origin/master But these WOULD NOT: $ git branch --set-upstream=origin/master $ git branch --set-upstream origin/master j.