4

I have a branch with ~50 commits pushed to origin. Then one day, I'd like to edit the text of the commit messages (because we are using a reference to Jira task in the commit message, and I need to fix it). So the only way I know is to run an interactive rebase:

git rebase -i origin/my-precious-branch~30 my-precious-branch

and then I select a few commits and change pick to r (for reword). And what happens next is what puzzles me. For most of the commits - it simply opens the editor where I can manually alter the commit text (fine). But then it stops for one of them:

error: could not apply 616b308fe9e... OLD-MESSAGE: 1

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Could not apply 616b308fe9e3d4cd8845d090720f1cdad97add73... OLD-MESSAGE: 1

What is happening here? And why?

Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106

1 Answers1

1

Based on your comments, it looks like you have one or more merge commits which your rebase is hitting. Rebasing a merge commit gets complicated, because you either have to redo the merge, or possibly let Git try to recreate the merge. In any case, the conflict you are encountering is likely due to that it is a merge commit.

See here for how to handle this situation:

Rebasing a Git merge commit

If you are prepared for such conflicts, then you may still reword the commit comments.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
  • Well. It wouldn't let me just `git rebase --continue`. What I actually had was what looked like a merge conflict. So I am just manually editing the merge conflict, `git add` the file and then `git rebase --continue`. I confirm - before that I have NOT edited the contents of any "rebased" file. – Grzegorz Oledzki Mar 16 '18 at 08:33
  • @GrzegorzOledzki Are any of these commits _merge_ commits? – Tim Biegeleisen Mar 16 '18 at 08:35