Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Merge conflicts during reword (git rebase -i)

It seems, I am lacking some understanding of git.

I am currently in the process of an extensive

git rebase -i --root

on origin/main(master), which is not a fork.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • Commits are not reordered
  • There are several merge commits into main

My todo file contains only

  • pick and
  • reword,

as many commit messages must be changed to pass commit linting.

Why do I have to manually resolve such merge conflicts?

CONFLICT (content): Merge conflict in file1
CONFLICT (content): Merge conflict in file2

I would expect that changing commit messages should be possible independently of the changes in the code base.

Could one reason be past forced updates?

>Solution :

Because you did not use --rebase-merges, you are missing merges with changes (like conflict resolution)… and that is causing the current conflicts in the rebase. If you only will do a reword of a commit (and you won’t change any files), you should try:

git rebase --rebase-merges -i --root

Then, everytime you hit a conflict (like in some merge commits where you faced them originally), you can do this:

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

Until the rebase is finished.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading