Git: change last commit’s message

less than 1 minute read


git commit --amend -m "new commit message"

Notice this changes the last commit’s message only. Also it will only work if you haven’t pushed it yet.

(Note: Technically, it could work if you have already pushed it, but you’d need to do a forced push - which would rewrite the repository and possibly force other people who had alterady pulled the older-messaged-commit to, in the worst case, clone the repo again.)




Leave a Comment