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

Re: How to merge from newer branch to older branches?

From
Jeff King <peff@peff.net>
Date
Apr 22, 2009, 21:17 UTC
Message-ID
<20090422211710.GA16096@coredump.intra.peff.net>
In-Reply-To
<2729632a0904221401u43af69a5ncec0f3f274ad648f@mail.gmail.com>
On Wed, Apr 22, 2009 at 02:01:01PM -0700, skillzero@gmail.com wrote:
> I'm not sure I understand. When I did the original rebase of "feature"
> onto the merge-base of all the branches I wanted to merge to (v1.1 and
> v1.2 in this case), the end result was that "feature" is now based on

Err, sorry, I was confusing your "future" branch and your "feature" branch. Wherever I said "feature", I meant "future", and "topic" I meant "feature". Yikes.

So you would make bug-fixes on "feature", and then just re-merge it to 1.1, 1.2, and future.

> the merge-base. When I merged "feature" into 1.1, I had to fix some
> conflicts so in the log I see my conflict fix commit then a merge
> commit, but "feature" wasn't changed (only v1.1 was).

Right. So now the merge-base between feature and 1.1 is the new merge commit. And when you re-merge them, you will only look at things that happened on the feature branch since that merge-base.

Show 5 quoted lines
> I was thinking that if I find a bug in my original "feature" branch, I
> would commit the fix to the "feature" branch then merge that into
> v1.1, v1.2, master, etc. But I was thinking that when I tried to merge
> "feature" into v1.1 (which previously needed a commit to fix
> conflicts), I'd need to re-fix those same conflicts.

Nope, because the merge commit already records the state of the tree once those conflicts are fixed. Now it's possible that the _bugfix_ may have its own conflicts. But you shouldn't see the same conflicts again.

> When I look at the log for v1.1 though, maybe I just misunderstood the
> way the conflicts are resolved in git? I was thinking the conflicting
> merge would end up as one big commit that's a combination of the
> "feature"'s commits and my conflict fixes.

Sort of. It is a new commit with two parents: the previous tip of v1.1, and the tip of "feature". But its tree contains the state with all of v1.1, all of feature's commits, and your fixes.

-Peff
Previous: skillzero@gmail.comNext: John M. Dlugosz
Message 8 of 9 in “How to merge from newer branch to older branches?”
  1. skillzero@gmail.comApr 21, 2009
  2. Jeff KingApr 21, 2009
  3. Junio C HamanoApr 22, 2009
  4. Jeff KingApr 22, 2009
  5. skillzero@gmail.comApr 22, 2009
  6. Jeff KingApr 22, 2009
  7. skillzero@gmail.comApr 22, 2009
  8. Jeff KingApr 22, 2009
  9. John M. DlugoszApr 22, 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.