Until a minute ago, I had a Git repo where the last commit had an empty commit message. I've filled it in by squashing a new commit onto it with git rebase -i
(I was planning to amend the contents anyway) but I would still like to know if there's a proper way to fill in empty commit messages.
I tried
git commit --amend
but that didn't work, then I tried
git rebase -i HEAD^
and a reword
. Both attempts resulted in Git saying
fatal: commit has empty message
and quitting.
EDIT: to clarify, what finally worked was
# change some stuff
git commit
git rebase -i HEAD~2
# squash the last two commits
but this seems like a hack.
This seems to be a bug which hasn't been fixed yet (although there are proposed patches for it). As a workaround, you can provide the message on the command line:
git commit --amend -m "foo"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With