"git pull REMOTE" question
From: Miles Bader <hidden>
Date: 2016-06-15 22:43:30
Hi,
I have a .git/config file in my tree that looks like:
[remote "origin"]
url = ssh://HOST.org/home/miles/git/PROJECT.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "usb"]
url = /media/usb/git/PROJECT.git
fetch = +refs/heads/*:refs/remotes/usb/*
[branch "master"]
remote = origin
merge = refs/heads/master
and I'm normally using branch "master".
"git pull" or "git push", without arguments, do exactly the right thing for
interacting with the "origin" remote.
When I want to push to "usb" (a usb thumbdrive), "git push usb" also does I
want, but "git pull usb" does not: the git-fetch phase of the git-pull
correctly fetches all the proper objects from the usb repository, but the
git-merge part of the git-pull fails with an error message like:
Warning: No merge candidate found because value of config option
"branch.master.merge" does not match any remote branch fetched.
No changes.
[See end of this message for a more complete output of a the pull command.]
After doing the pull, I can manually do the merge I want using a
command like "git merge remotes/usb/master", but it's kind of annoying
to have to do this every time.
From my experimentation, it seems that this is because the local
branch "master" can only ever be associated with one remote ("origin"
in this case), and the "branch.master.merge" config _only_ applies to
that remote.
Is there a way to set things up so that "git pull REMOTE"
automatically merges fetched branches when doing a non-default pull?
If not, wouldn't this be a good feature to add?
Thanks,
-Miles
Here's the complete output of the git-pull command:
$ git pull usb
remote: Generating pack...
remote: Done counting 59 objects.
remote: Result has 38 objects.
remote: Deltifying 38 objects...
remote:
Unpacking 38 objects...
remote: Total 38 (delta 21), reused 24 (delta 8)
97% (37/38) done 100% (38/38) done
* refs/remotes/usb/master: storing branch 'master' of /media/usb/git/PROJECT
commit: 243e656
* refs/remotes/usb/branch1: storing branch 'branch1' of
/media/usb/git/PROJECT
commit: e08c6ac
* refs/remotes/usb/branch2: storing branch 'branch2' of
/media/usb/git/PROJECT
commit: 8ad20e8
* refs/remotes/usb/branch3: storing branch 'branch3' of
/media/usb/git/PROJECT
commit: e874f3d
Warning: No merge candidate found because value of config option
"branch.master.merge" does not match any remote branch fetched.
No changes.
$
--
Everywhere is walking distance if you have the time. -- Steven Wright