Remove your last git commit

Because some time you mess up but notice one second too late

Sometimes you get so much into the flow that you accidentally commit stuff too early, and typically notice right after committing.

Undoing the last git commit is easy enough, thankfully. If you didn’t push already, just run

git reset HEAD^

If you did push to your remote repository, but hopefully no one else pulled already, you can run the following command after the previous one:

git push origin +HEAD

…which will rewrite history, but sometimes that’s OK.

Credits: StackOverflow #1, #2