git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: SungHyun Nam <goweol@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git pull/merge master on other branch
Date: Fri, 9 May 2008 11:06:47 +0200	[thread overview]
Message-ID: <200805091106.47447.johan@herland.net> (raw)
In-Reply-To: <g011ve$8ln$1@ger.gmane.org>

On Friday 09 May 2008, SungHyun Nam wrote:
> 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?

Looks good, AFAICS


Have fun! :)

...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2008-05-09  9:07 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
2008-05-09  9:06     ` Johan Herland [this message]
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=200805091106.47447.johan@herland.net \
    --to=johan@herland.net \
    --cc=git@vger.kernel.org \
    --cc=goweol@gmail.com \
    /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).