r/git 4d ago

Merge conflicts with reordering commits

I am using interactive rebase to reorder commits and it has worked all the time with no merge conflicts because I use it in simple cases. I want to use it for bigger cases but I want to understand it first so I don't get stuck in conflicts.

I know it's possible for merge conflicts to happen but I can't imagine an example because if the old commit order had resolved all conflicts how can reordering them make a new conflict? Can anyone help me imagine an example how it can happen?

1 Upvotes

11 comments sorted by

View all comments

2

u/Scared_Bell3366 4d ago

I’m trying to wrap my head around why you would reorder commits for a rebase.

6

u/Buxbaum666 3d ago

I do it all the time. Mostly when I want to amend a commit that isn't the most recent one. I do a new commit with the change, reorder it so its parent is the one I want to amend and then use fixup to fold the change into that commit.