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

Re: Rebasing with merges and conflict resolutions

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Mar 26, 2010, 07:02 UTC
Message-ID
<4BAC5C14.4060903@viscovery.net>
In-Reply-To
<20100326031111.GB27737@kiwi.sharlinx.com>
Please don't set Mail-Followup-To on this list.
Am 3/26/2010 4:11, schrieb R. Tyler Ballance:
Show 10 quoted lines
> Two contributors worked in tandem on a particular project, constantly merging
> back and forth between each other creating a history of 118 commits total with
> 37 of them being merge commits, 7 of those merge commits having conflict
> resolutions involved.
> 
> I would /like/ to rebase those into a more linear revision history, but I
> can't seem to find any set of commands that doesn't have me:
>    a) Manually re-doing every conflict resolution and merge (git rebase -p master)
>    b) Drastically diverging from the original topic branch and entering some
>       sort of mergeless hell (git rebase master)

I'm afraid you can't avoid the merge conflict resolutions. But you can let you help by git-rerere. Look into the script rerere-train.sh that lets you prime your rerere database.

http://repo.or.cz/w/alt-git.git/blob_plain/master:/contrib/rerere-train.sh
> Is it even possible to straighten this out without a massive rework of these
> commits?

I would sort the commits into topics and then repeatedly rebase -i the history involved onto the same commit, each time removing those commits that do not belong to the topic. That is, you get a forest of topics sprouting from the same commit. Finally, merge the topics back together.

IOW, I wouldn't aim at a completely linear history, at least not at the first try.

> In the future, is there a better way for two developers to work in the same
> back-and-forth fashion (code ping pong!) without leading to *heavily* merged
> histories that are unpossible to untangle?

Discipline. Keep developers focused on their topic. Merge only after a topic is completed. Do not give in to "oh, *your* feature is cool, *I* want to have it now, so I merge it".

-- Hannes
Previous: R. Tyler BallanceNext: R. Tyler Ballance
Message 2 of 5 in “Rebasing with merges and conflict resolutions”
  1. R. Tyler BallanceMar 26, 2010
  2. Johannes SixtMar 26, 2010
  3. R. Tyler BallanceMar 26, 2010
  4. Jon SeymourMar 26, 2010
  5. Jon SeymourMar 26, 2010

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.