duhan
Blog

Update Your Last Commit Without Changing the Message

Ever pushed a commit and immediately realized you forgot something?
I do that more often than I’d like.

Luckily, there’s 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. No 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. No new commit, no message change.

🔗 Related posts