Thread (9 messages) flat view 9 messages, 6 authors, 2016-06-15

Re: git pull/merge master on other branch

From: Kevin Ballard <hidden>
Date: 2016-06-15 22:44:35

On May 9, 2008, at 1:24 AM, Johan Herland wrote:
On Friday 09 May 2008, SungHyun Nam wrote:
quoted
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).

If you know the pull will just be a fast-foward, then you can do  
something like

   git fetch origin && git update-ref master origin/master

-Kevin Ballard

-- 
Kevin Ballard
http://kevin.sb.org
kevin@sb.org
http://www.tildesoft.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help