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

Re: git merge after git cherry-pick?

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jul 23, 2008, 17:56 UTC
Message-ID
<20080723175600.GL22606@neumann>
In-Reply-To
<48876709.3090504@sneakemail.com>
On Wed, Jul 23, 2008 at 07:14:49PM +0200, "Peter Valdemar Mørch (Lists)" wrote:
Show 19 quoted lines
> On a branch, b, made off of master, I've made the commits b1, b2, b3 and  
> b4.
>
> Back on master, I need commit b1 and b3 immediately. So I:
>
> $ git checkout master
> $ git cherry-pick "b1's SHA"
> $ git cherry-pick "b3's SHA"
>
> Now, both b and master contain b1 and b3. How do I now create a log of  
> "what remains to be merged from b to master", i.e. only b2 and b4? And  
> how do I merge b2 and b4 to master, so master's log shows b1, b3, b2 and  
> b4 and doesn't show b1 and b3 twice, which is what I get if I:
>
> $ git merge b
>
> after the cherry-picks above. Also I noticed, that if I merge master  
> into b (to keep up-to-date with master) b1 and b3 are also mentioned 
> twice.
You could use 'git rebase' for that.
e.g. now the history of your master and b branches look like this:
  o---X---b1'---b3'---Y   master
   \
    b1---b2---b3---b4   b

The command 'git rebase master b' will then turn this history into the following:

  o---X---b1'---b3'---Y   master
                       \
                        b2---b4   b
After this 'git merge b' will do what you would like it to do.

Regards, Gábor

Previous: Peter Valdemar Mørch (Lists)Next: Peter Valdemar Mørch (Lists)
Message 2 of 4 in “git merge after git cherry-pick?”
  1. Peter Valdemar Mørch (Lists)Jul 23, 2008
  2. SZEDER GáborJul 23, 2008
  3. Peter Valdemar Mørch (Lists)Jul 23, 2008
  4. Jakub NarebskiJul 23, 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.