Yesterday, I have a problem with a commit when I deployed it to production. The server had a different (oldest) version of my development stack and this caused an error in my app.
So I need to completely remove the last pushed commit. After a quick research on Git documentation, I came accross with:
$ git reset --hard HEAD~1
With this command I go back one commit (
HEAD~1) in my Git log. This is a dangerous Git command, so you need to be careful.
Then as I yet pushed that wrong commit to my remote repo, I need to force push the new head commit:
$ git push origin HEAD --force