In Git when I have commits eg. A - B - C and I want to edit the B commit, I
- use
git rebase -i <A-commit-hash>, - in the list I write
editcommand in front ofBcommit, - git rebase stops right after
Bcommit so I can fix anything I want usinggit commit --amend, - and then I continue using
git rebase --continue.
As far as I know this is the best practice how to do this. With this method I can edit any commit in the past (as long as it hasn't been pushed to remote branch yet), and moreover with -p flag I can even preserve the merges. This is just great.
My current problem is: I did a mistake (typo) on one line in a merge commit (while resolving a conflict when merging two branches).
I'd like to fix it but I don't know how to make git rebase to stop at a merge commit. The git rebase -p -i <blah> list ignores merge commits, so I cannot write edit command in front of it and make the git rebase stop there to let me edit it.
Any help please? I just want to fix this line in the merge commit while preserving all the commits (and merges) after it.
Thanks.