Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the wrong commit message in Git [duplicate]

Tags:

I a have a small problem with Git commit. So I am working on some project and using Git. I did a Git commit and I accidentally wrote a wrong commit message. So my question is:

Is there anyway I can change the commit message in Git?

NOTE: I have tried to do this way:

git commit -a --amend -m "New Commit Message"

But it doesn't work. Why?

Thanks.

like image 937
Michael Avatar asked Aug 13 '13 12:08

Michael


1 Answers

Lose the first -a you aren't adding any files, you're just changing the HEAD commit:

git commit --amend -m"New Commit Message"
like image 173
Abizern Avatar answered Oct 23 '22 02:10

Abizern