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

Merge *to* branch instead of merge *from* branch?

From
Peter Karlsson <peter@softwolves.pp.se>
Date
Apr 26, 2008, 22:42 UTC
Message-ID
<alpine.DEB.1.00.0804270037220.1149@perkele.intern.softwolves.pp.se>
Hi!
My most common use-case of Git is currently somewhere along the lines of
   git checkout master # start from here
   git checkout -b new_branch
   ...edit...
   ...commit...
   git merge master # to make sure I have the latest changes
   ...make sure it all works...
   git checkout master
   git merge new_branch # fast-forwards master to new_branch's HEAD

Is there any way of not having to do the "git checkout master" first? Basically I want a flag to merge or checkout saying that I want to merge my branch into the branch I'm switching to. I can't seem to find any such flag.

(My problem is not that I have to write two commands, the problem is that checking out master and then fast-forwarding it back to where I was is slow, working on a network-mapped share on Win32 as I am, and it causes the ancient compiler I'm using to re-compile nearly everything, which is also slow).

-- 
\\// Peter - http://www.softwolves.pp.se/
Next: Avery Pennarun
Message 1 of 3 in “Merge *to* branch instead of merge *from* branch?”
  1. Peter KarlssonApr 26, 2008
  2. Avery PennarunApr 26, 2008
  3. Kelvie WongApr 27, 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.