When invoking git rebase --continue
after a normal rebase conflict, the editor (GIT_EDITOR
) opens and asks for modifying the commit message. Because commit messages may contain leading # this might fail.
$ export GIT_EDITOR=true
$ git rebase --continue
Aborting commit due to empty commit message.
error: could not commit staged changes.
In the Git rebase documentation there is following paragraph
Commit Rewording When a conflict occurs while rebasing, rebase stops and asks the user to resolve. Since the user may need to make notable changes while resolving conflicts, after conflicts are resolved and the user has run git rebase --continue, the rebase should open an editor and ask the user to update the commit message. The merge backend does this, while the apply backend blindly applies the original commit message.
So I tried to switch to the apply backend, but it still fails:
$ export GIT_EDITOR=true
$ git config rebase.backend apply
$ $ git config --list | grep backend
rebase.backend=apply
$ git rebase --continue
Aborting commit due to empty commit message.
error: could not commit staged changes.
How to force Git to blindly apply the commit message?
#
in the commit messages. But I'd argue that it's a risky proposition anyway. See this question.core.commentChar=auto
might just help you. – Socalledgit rebase --continue
continues that particular back-end. However, theGIT_EDITOR=true
trick should work and I'm not sure why it did not. – Acrilangit -c core.commentChar=auto rebase <commit> <branch>
has exactly the same problem.git -c rebase.backend=apply rebase <commit> <branch>
works, but I wonder whether it has some negative consequences. There surely is a reason why git defaults to merge and not apply. – Hilliary