Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill in an empty commit message?

Tags:

git

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.

like image 493
Fred Foo Avatar asked May 08 '12 15:05

Fred Foo


1 Answers

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"
like image 159
mtvec Avatar answered Oct 07 '22 11:10

mtvec