mhagger / git-imerge

Incremental merge for git
GNU General Public License v2.0
2.7k stars 126 forks source link

Exact equivalent of `git rebase --onto ancient origin/ancient modern` ? #183

Closed rulatir closed 3 years ago

rulatir commented 3 years ago

I have several "rebase checkpoints" along a very long topic branch. When I rebase it on master, I rebase those checkpoints (represented as branches) in order. This helps me avoid aborting the whole rebase in the rare cases when I run into insurmountable difficulties near the end of the rebase.

After the rebase, I always push all the checkpoints to the repository so that I can have an origin/ reference for each of them ready for the next rebase.

I rebase each checkpoint branch using the 3-argument rebase --onto. Assuming the previous successfully rebased checkpoint is named ancient and the one I want to rebase now is named modern, I use the following command:

git rebase --onto ancient origin/ancient modern

What is the exact git-imerge equivalent of this command?

rulatir commented 3 years ago

(Just realized I had already asked this exact question, sorry!)

mhagger commented 3 years ago

As you know, git-imerge doesn't have the equivalent of the --onto option.

If I understand your use case correctly, the end effect of your multiple rebases would be the rebase of a full branch, which, if you did it directly, wouldn't need the --onto option. You only need the --onto option because you want to preserve some checkpoints. Is that correct?

If so, then IMO the correct solution to this problem would be for you to run a full git imerge rebase, but for git-imerge to make it possible to interrupt such a rebase while it is in progress even if it hasn't been completed. For example, see #101. That way you wouldn't need to do any additional manual bookkeeping but could still stop if you get stuck.