Changing the last commit is a pretty common use case in Git.
Whether you forgot to add a file or simply want to revise the commit message, you will probably use
$ git commit --amend
It adds the staged changes to the previous commit and prompts your default editor to update the commit message.
If you only wanna modify the commit message use the
$ git commit --amend -m "Boosted Commit Message"
But in many cases, we want to change the last commit without editing the commit message.
Today I Learned how to do exactly that, just add the
$ git commit --amend --no-edit
No popup editor and two seconds saved.
The truth is, amending a commit actually replaces it entirely, resulting in a new commit with its own ref.
Think twice before you do that when working on a commit shared with others, as it may cause merge conflicts.