Thread (14 messages) flat view 14 messages, 3 authors, 2016-06-15

Re: [BUG] inconsistent behavior with --set-upstream vs --set-upstream-to

From: Jeff King <hidden>
Date: 2016-06-15 22:56:36

On Tue, Apr 02, 2013 at 10:07:01AM -0700, Garrett Cooper wrote:
	It looks like git branch --set-upstream-to doesn't function with 1.8.1.3 until I run --set-upstream. Is this a known bug?
No, but I do not think that is exactly what is going on.
root@fuji-current:/usr/src # git branch --set-upstream-to origin/pjdfstest-onefs pjdfstest-onefs
fatal: Not a valid object name: 'origin/pjdfstest-onefs'.
This is complaining that origin/pjdfstest-onefs does not actually exist
Does it? If the pjdfstest-onefs branch exists on the remote, do you need
to do a "git fetch" to make sure we have a local
refs/remotes/origin/pjdfstest-onefs tracking branch locally?
root@fuji-current:/usr/src # git branch --set-upstream origin/pjdfstest-onefs pjdfstest-onefs
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
Branch origin/pjdfstest-onefs set up to track local branch pjdfstest-onefs.
This did _not_ create the remote-tracking branch refs/remotes/origin/pjdfstest-onefs.
It created a new local branch called "origin/pjdfstest-onefs" (i.e.,
refs/heads/origin/pjdfstest-onefs), whose upstream is another local
branch "pjdfstest-onefs". That "backwards" order to the arguments is why
--set-upstream is deprecated; many people have made the same mistake.
root@fuji-current:/usr/src # git branch --set-upstream-to origin/pjdfstest-onefs pjdfstest-onefs
Branch pjdfstest-onefs set up to track local branch origin/pjdfstest-onefs.
Note how it says "local branch" here; you are not tracking anything at
the origin. You are tracking a local branch that happens to have
"origin/" in the name.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help