Photo by Markus Winkler on Unsplash
Changing a commit message with Git
๐กYou can change a commit message only for emergencies, so I recommend you be careful because you can break the pull request's reference.
1.- If you wrote a commit message incorrectly and pushed it, you can change this message immediately using git commit --amend
command, this command open a text editor to change the message. For exit press ESC + Shift + :
and write :wq
to save changes.
git commit --amend
2.- Force push
with command:
git push origin main -f
3.- Use git log
command to see historical changes.
git log
Reference:
ย