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

Re: git pull/merge master on other branch

From
SNSungHyun Nam <goweol@gmail.com>
Date
May 13, 2008, 02:22 UTC
Message-ID
<4828FB7F.3030907@gmail.com>
In-Reply-To
<8C649BDA-41CA-4105-86C5-103B4A8BEEC1@sb.org>
Kevin Ballard wrote, at 5/10/2008 2:16 AM:
 > On May 9, 2008, at 1:24 AM, Johan Herland wrote:
 >
 >> 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).
 >
 >
 > 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

It seems it worked, but I see a warning message "refname 'master' is ambiguous." Can I fix this warning message?

[test] ~/tmp/t[52]$ git fetch origin
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
 From /d/user/namsh/tmp/repo/
    6e13bb5..8d1c620  master     -> origin/master
[test] ~/tmp/t[53]$ git update-ref master origin/master
[test] ~/tmp/t[69]$ git log master
warning: refname 'master' is ambiguous.
commit a358783b78facffb9a8f69d2189aa716495d95ba
..

[test] ~/tmp/t[54]$ git rebase master warning: refname 'master' is ambiguous. warning: refname 'master' is ambiguous. First, rewinding head to replay your work on top of it... Fast-forwarded test to master.

regards, namsh

Previous: Kevin BallardNext: Lars Hjemli
Message 6 of 9 in “git pull/merge master on other branch”
  1. SungHyun NamMay 9, 2008
  2. Johan HerlandMay 9, 2008
  3. SungHyun NamMay 9, 2008
  4. Johan HerlandMay 9, 2008
  5. Kevin BallardMay 9, 2008
  6. SungHyun NamMay 13, 2008
  7. Lars HjemliMay 13, 2008
  8. Brandon CaseyMay 13, 2008
  9. Kelvie WongMay 13, 2008

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.