How to rebase a git branch that contains a merge commit *and* corresponding, previous branch-point

I am trying to interactively rebase commits from the branch tmp/20241220-rebase-source onto tmp/20241220-rebase-target.
The commits to rebase include a branching point and corresponding merge-commit (ba87116b). This is how tmp/20241220-rebase-source looks like:

* 1df0fff2
* f2659d53
*   ba87116b  <-- I believe this commit contained merge conflicts, which were fixed manually; but I want to rebase the commit as is
|  
| * decacca4
* | 22820e76
|/  
* 212d1db1
* 304733f0
* e7d2ed57
* 78fd41bf
* 15251fab
* 6854d87c
* 53d2b1c8
* fbf44673
* 911afc16
* bb56930f
* 75d7085d
* 23674b1a <- commit is already cherry-picked into `tmp/20241220-rebase-target`, to fix a merge conflict (the following commits do to touch this file and thus there cannot be a merge conflict) 
| <- other commits to ignore from rebase, below 
|

I cherry-picked the first commit (23674b1a), because it caused a merge-conflict in a single file, which I fixed manually.
All other commits /add/ new files and hence should not produce merge conflicts.

git checkout tmp/20241220-rebase-source
git rebase --rebase-merges --onto tmp/20241220-rebase-target --interactive 23674b1a

Running the rebase script results in merge conflicts for the merge commit ba87116b:

(tmp/20241220-rebase-source)> git rebase --rebase-merges --onto tmp/20241220-rebase-target --interactive 23674b1af2c7d4451ba5a5b788e91fcaf9d3e90d

Auto-merging example_form_xml/form1/file1.xml
CONFLICT (content): Merge conflict in example_form_xml/form1/file1.xml
Auto-merging example_form_xml/form1/file2.xml
CONFLICT (add/add): Merge conflict in example_form_xml/form1/file2.xml
Could not apply ba87116b...

I belive this this issue is caused, because the original merge commit ba87116b contained conflicts, which were resolved manually and that I have resolve them again in the rebase. But this is not my desired behavior, since I just want to rebase the commit as is.

Is this possible and if so, how do I achieve this?

1

This is not the most elegant approach to solving it but it will allow you to move forward. If you think about it, ba87116b is just what code would look like if you had developed decacca4 on top of 22820e76 (or viceversa) instead of 212d1db1. Being that the case, I would straighten that branch before I tried the rebase:

git rebase 212d1db1 1df0fff2

Use the right branch name as the second commit id over there.

What should happen when you run this rebase is that it should stop on conflicts when applying either 22820e76 or decacca4 (whichever was applied second). When that happens, just take advantage of the tree in ba87116b as that is the resulting code that should be there, no need to redo the conflicts by hand:

git restore --source=ba87116b --worktree --staged -- .
git rebase --continue

And that should allow the rebase to finish…. and now you can rebase the branch as it is a straight line and you have incorporated the previous conflict resolution in your straightened branch.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật