git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Miles Bader" <miles@gnu.org>
To: git@vger.kernel.org
Subject: "git pull REMOTE" question
Date: Wed, 22 Aug 2007 13:23:52 +0900	[thread overview]
Message-ID: <fc339e4a0708212123p6e922b4cy3f5f19bfafafa395@mail.gmail.com> (raw)

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

             reply	other threads:[~2007-08-22  4:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-22  4:23 Miles Bader [this message]
2007-08-22  4:35 ` "git pull REMOTE" question Junio C Hamano
2007-08-22  4:44   ` Miles Bader
2007-08-22  5:11     ` Junio C Hamano
2007-08-22 16:44       ` Jon Loeliger
2007-08-22 20:29         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc339e4a0708212123p6e922b4cy3f5f19bfafafa395@mail.gmail.com \
    --to=miles@gnu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).