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

Re: git merge and cherry-pick and duplicated commits?

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jan 15, 2009, 23:09 UTC
Message-ID
<200901160009.11124.markus.heidelberg@web.de>
In-Reply-To
<2729632a0901141033p47b4d8dah46f5bac27307d306@mail.gmail.com>
skillzero@gmail.com, 14.01.2009:
Show 40 quoted lines
> On Wed, Jan 14, 2009 at 12:34 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> 
> > After you created the fixup, you have this situation:
> >
> >    o--o--o   <- A (feature branch)
> >   /
> > --o--x        <- X (the fix-up branch)
> >   \
> >    o--o--o   <- Z (probably your master)
> >
> > You merge the fix-up into the feature branch and continue developing the
> > feature:
> >
> >    o--o--o--M--o--o   <- A
> >   /        /
> > --o--x-----'           <- X
> >   \
> >    o--o--o            <- Z
> >
> > Other people need the fix in Z right now, so you merge it into Z as well:
> >
> >    o--o--o--M--o--o   <- A
> >   /        /
> > --o--x-----<           <- X
> >   \        \
> >    o--o--o--N         <- Z
> >
> > You complete your feature and merge it into Z:
> >
> >    o--o--o--M--o--o     <- A
> >   /        /       \
> > --o--x-----<         \   <- X
> >   \        \         \
> >    o--o--o--N---------O <- Z
> >
> > The fix-up commit is only once in your history.
> 
> Thanks for the info. That's what I was hoping, but I was thinking that
> I'd get duplicate commits if I did that. I'll have to try it out when
> I run into this situation again.

Note, that you'd get 2 merge commits for this fix-up commit into branch Z. The first from merging X into Z, the second is created from merging X into A and occures in Z when merging A into it.

Markus
Previous: Junio C HamanoNext: Boaz Harrosh
Message 10 of 16 in “git merge and cherry-pick and duplicated commits?”
  1. skillzero@gmail.comJan 14, 2009
  2. Brian GernhardtJan 14, 2009
  3. skillzero@gmail.comJan 14, 2009
  4. Johannes SixtJan 14, 2009
  5. skillzero@gmail.comJan 14, 2009
  6. Johannes SixtJan 14, 2009
  7. skillzero@gmail.comJan 14, 2009
  8. Peter BaumannJan 14, 2009
  9. Junio C HamanoJan 14, 2009
  10. Markus HeidelbergJan 15, 2009
  11. Boaz HarroshJan 14, 2009
  12. Nanako ShiraishiJan 14, 2009
  13. Thomas RastJan 14, 2009
  14. Alex RiesenJan 14, 2009
  15. skillzero@gmail.comJan 14, 2009
  16. Sitaram ChamartyJan 14, 2009

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.