How to change the last commit message?
git commit --amend
To change your last commit message use git commit --amend
. The commit --amend
command opens an editor, where you can update the commit message.
git log --oneline
8781cfd (HEAD -> main) Adding image.png
9cfff18 Adding file.txt
git commit --amend
[main 0c5fbac] Adding image.png and README.md
Date: Sat May 15 15:24:48 2021 +0200
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 image.png
git log --oneline
0c5fbac (HEAD -> main) Adding image.png and README.md
9cfff18 Adding file.txt
See git commit to learn more about it.