Some commands that are used occasionally and end up needing a stack overflow search.
Get rid of any commits that are not pushed and reset to origin.
git checkout master
git reset --hard origin/master
Get rid of commits not pushed but keep the changes.
git reset HEAD~1 --soft