Update Your Last Commit Without Changing the Message
—
Have you ever pushed a commit and immediately realized you forgot something?
I do that more often than I would like.
Luckily, there is a simple fix:
git commit --amend --no-edit
Let’s say you committed your changes locally but before pushing you realize you forgot to update the version number. You don’t need to make a new commit, just stage the file again and run:
git add .
git commit --amend --no-edit
And just like that, your last commit is updated.