git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SungHyun Nam <goweol@gmail.com>
To: git@vger.kernel.org
Subject: Re: git pull/merge master on other branch
Date: Fri, 09 May 2008 17:28:13 +0900	[thread overview]
Message-ID: <g011ve$8ln$1@ger.gmane.org> (raw)
In-Reply-To: <200805090824.12772.johan@herland.net>

Johan Herland wrote, at 5/9/2008 3:24 PM:
> On Friday 09 May 2008, SungHyun Nam wrote:
>> Hello,
>>
>> If I am on a branch (reguarly rebased), I don't want to switch to
>> master branch, but merge origin into master.
>> If I switch to master and pull and switch to branch, I have to
>> rebuild almost of sources.
>>
>> How I can pull origin into master without switching to master
>> branch?
> 
> You can't; merging requires use of the working tree (to resolve conflicts).
> 
> However, what you can do is make a local clone of your project (cheap,
> because it just hardlinks files from the original repo), and checkout the
> master branch in the clone, perform the merge (after having set up the same
> origin and retrieved its contents), and then fetch (or push) the result back
> into the original repo (remember: "fetch" instead of "pull", since the
> latter will initiate a merge with your current branch).

I tested and it seems work fine.

$ mkdir repo; cd repo; git init; echo 'aaa' > a; git add .; git ci -m 
'aaa'; cd ..
$ git clone repo t; cd t; git co -b test; cd ..
$ cd repo; echo 'bbb' >> a; git ci -m 'bbb' a; cd ..
$ git clone t t2; cd t2; git remote add central ../repo; git pull 
central master; git push origin; cd ..
$ cd t; git log; git log master; git rebase master

Did I do correctly?

Thanks,
namsh

  reply	other threads:[~2008-05-09  8:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  5:26 git pull/merge master on other branch SungHyun Nam
2008-05-09  6:24 ` Johan Herland
2008-05-09  8:28   ` SungHyun Nam [this message]
2008-05-09  9:06     ` Johan Herland
2008-05-09 17:16   ` Kevin Ballard
2008-05-13  2:22     ` SungHyun Nam
2008-05-13 16:08       ` Lars Hjemli
2008-05-13 17:24     ` Brandon Casey
2008-05-13  3:12 ` Kelvie Wong

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='g011ve$8ln$1@ger.gmane.org' \
    --to=goweol@gmail.com \
    --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).