Re: [PATCH 1/3] branch: introduce --set-upstream-to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

>> The immediate problem that seems to trip people up is that it is very
>> tempting to run
>>
>> 	git branch --set-upstream junio/master
>
> I think we have discussed this already a few days ago.  See my
> comment in the earlier thread before this round.

You wrote[*]:

| I think it was a mistake that nobody noticed that it is likely that
| the operation most often will be done for the current branch and the
| usual "give me one branch name to operate on, or I'll operate on the
| current branch" command line convention of "git branch" commannd is
| not a good fit for it, when "set upstream" feature was added

with which I completely agree.  You then moved on to

|                                                               and
[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.

As far as I can tell, nobody really thought very hard about what
--set-upstream would do when passed only one argument.  It should have
been made to error out and only later change if someone had an idea
about how to make it useful.

Luckily we have a way out.  Any example transition plan looks like
the following.

DAY 1.

	$ git branch --set-upstream origin/master
	Branch origin/master set up to track local branch debian-sid.
	hint: If you intended to make the current branch track
	hint: origin/master, you can recover with the following commands:
	hint:  $ git branch -d origin/master
	hint:  $ git branch --set-upstream master origin/master
	$

DAY 2.

	$ git branch --set-upstream origin/master
	Branch origin/master set up to track local branch debian-sid.
	warning: using --set-upstream when creating a new branch is deprecated
	hint: use --track instead
	hint:
	hint: If you intended to make the current branch track
	hint: origin/master, you can recover with the following commands:
	hint:  $ git branch -d origin/master
	hint:  $ git branch --set-upstream master origin/master
	$

DAY 3.

	$ git branch --set-upstream origin/master
	fatal: no such branch "origin/master"
	$

DAY 4.

	$ git branch --set-upstream origin/master
	usage: git branch --set-upstream <branchname> <upstream>
	$

[*] http://thread.gmane.org/gmane.comp.version-control.git/201040/focus=201051
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]