git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Andrew Ottaviano <andrew_o1995@live.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: Rebase Question
Date: Wed, 12 May 2021 02:23:36 -0500	[thread overview]
Message-ID: <609b827884bfd_6e0fc2083c@natae.notmuch> (raw)
In-Reply-To: <MN2PR07MB59526F40B255183931649AD19C529@MN2PR07MB5952.namprd07.prod.outlook.com>

Andrew Ottaviano wrote:
> The difficulty with this is that if I have merge conflicts that show
> up on my first commit, I have to resolve that stupid thing for every
> subsequent commit.

I don't quite understand that. If you have resolved the chunk, then that
chunk is resolved, and the rest of the commits don't have to worry
about that...

Unless they touch *precisely* the same lines as the first commit, in
which case... Yeah, you have to resolve that stupid thing over and over.

> The solution that I thought of is instead of resolving conflicts from
> the bottom up (starting with earliest history), resolving from the top
> down (latest to earliest) and resolving the conflict in the commit it
> occurred.

Well, this is interesting because it's something I've wanted to write
about for a long time, and it's what I call my "pronged approach".


I actually do *both*; I do a rebase and fix the problems from 1) the bottom-up,
but after I have resolved the conflicts from 2) the top-down. In 1)
(bottom-up) I resolve the conflicts in a rebase, and in 2) I resolve the
conflicts in merge, but in *both* the end result sould be the exactly
same [`git diff 1) 2)` is empty].

Yes, it is more work, but at the end of the day I'm 100% sure I did the
rebase right, so I don't have to think about it that much; either
there's a diff or there isn't.

In fact, I rarely do just one rebase, because quite often I miss things,
so I do a second, or third, or fourth rebase, but at the end I make sure
that the diff with the merge (top-down approach) is the same.

To facilitate this work I use two tools: 1) git rerere [1] (others have
mentioned this), and 2) git reintegrate [2] (only useful if there's more
than one branch you are merging).


Yeah, it's a lot of work, but I'd rather do a lot of tedious work that
I'm 100% sure is correct, than do a little bit of work that I can't
easily verify.

Cheers.

[1] https://git-scm.com/docs/git-rerere
[2] https://github.com/felipec/git-reintegrate

-- 
Felipe Contreras

  parent reply	other threads:[~2021-05-12  7:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12  0:06 Rebase Question Andrew Ottaviano
2021-05-12  0:23 ` Jacob Keller
2021-05-12  0:29 ` Bryan Turner
2021-05-12  0:44   ` Jeff King
2021-05-12  6:22     ` Junio C Hamano
2021-05-12  7:23 ` Felipe Contreras [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-11 19:57 rebase question Ryan Sun
2011-03-13  1:05 ` Martin von Zweigbergk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=609b827884bfd_6e0fc2083c@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=andrew_o1995@live.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).