git/list[1] front-page[2] threads[3] people[4] search[5] about
 

"git pull REMOTE" question

From
Miles Bader <miles@gnu.org>
Date
Aug 22, 2007, 04:23 UTC
Message-ID
<fc339e4a0708212123p6e922b4cy3f5f19bfafafa395@mail.gmail.com>
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
Next: Junio C Hamano
Message 1 of 6 in “"git pull REMOTE" question”
  1. Miles BaderAug 22, 2007
  2. Junio C HamanoAug 22, 2007
  3. Miles BaderAug 22, 2007
  4. Junio C HamanoAug 22, 2007
  5. Jon LoeligerAug 22, 2007
  6. Junio C HamanoAug 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.