Some bad Git situations and how I got myself out of them
One thing not covered very well was what to do if you push to origin. My favourite way to fix this: use git revert to create an exact opposite commit to your bad commit.<p><pre><code>  git revert &lt;bad commit&gt;
  git push
</code></pre>
It leaves a history of the mistake, for better or worse, but it does undo the mistake on origin.