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.

Layer 1
Terminal Example
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.

Last modified on November 30, 2021.

You might also like