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

Re: rebasing merges

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 23, 2008, 07:52 UTC
Message-ID
<48D8A052.6000101@viscovery.net>
In-Reply-To
<2008-09-23-09-30-47+trackit+sam@rfc1149.net>
Samuel Tardieu schrieb:
Show 23 quoted lines
>>>>>> "Johannes" == Johannes Sixt <j.sixt@viscovery.net> writes:
> 
> Johannes> i.e. linearized history without merges.
> 
> A few days ago, I had a question in my team quite similar to Stephen
> concern. A developer had performed a merge of a complex feature and
> was ready to commit it
> 
>   --o--o--o--o--X        <-- origin
>      \           \
>       A--B--C--D--E      <-- master
> 
> when he realized that someone just pushed another change on origin
> while he was doing the complicating merge (with lots of conflicts to
> resolve). The configuration was then:
> 
>   --o--o--o--o--X--Y     <-- origin
>      \           \
>       A--B--C--D--E      <-- master
> 
> He would have wanted to have the merge rebased on E and Y instead of E
> and X before pushing, without going through all the conflicts
> resolution again (he didn't have "rerere" enabled).

If you mean "merge", and you are willing to keep E, then you do another merge to get this history:

  --o--o--o--o--X--Y     <-- origin
     \           \  \
      A--B--C--D--E--F   <-- master

and the previous conflicts will not show up again. But if you do not want E to show up in the history, like this:

  --o--o--o--o--X--Y     <-- origin
     \              \
      A--B--C--D-----F   <-- master
then you will have to resolve all conflicts again. Of course, you can keep
 E in a temporary branch, and you can selectively check out files from
that tree to safe some work, but whether this is possible depends on the
changes that Y introduces.
If you mean "rebase", then you get this after the first rebase:
  --o--o--o--o--X--Y               <-- origin
                 \
                  A'--B'--C'--D'   <-- master
Then you can rebase again to get this:
  --o--o--o--o--X--Y                  <-- origin
                    \
                     A"--B"--C"--D'   <-- master
at which time you don't see the old conflicts again.
-- Hannes
Previous: Samuel TardieuNext: Andreas Ericsson
Message 5 of 14 in “rebasing merges”
  1. Stephen HabermanSep 22, 2008
  2. Stephen HabermanSep 23, 2008
  3. Johannes SixtSep 23, 2008
  4. Samuel TardieuSep 23, 2008
  5. Johannes SixtSep 23, 2008
  6. Andreas EricssonSep 23, 2008
  7. Stephen HabermanSep 23, 2008
  8. Johannes SixtSep 23, 2008
  9. Andreas EricssonSep 23, 2008
  10. Stephen HabermanSep 23, 2008
  11. Andreas EricssonSep 23, 2008
  12. Stephen HabermanSep 23, 2008
  13. Stephen HabermanSep 23, 2008
  14. SZEDER GáborSep 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.