Last Updated: February 25, 2016
·
429
· mrallen1

Oh crap, I committed to master!

Sometimes when I'm not fully caffeinated or just in a careless rush I will make code changes and commit them to master.

This is a pretty easy problem to resolve using the reflog git maintains for you.

git branch oops
git reflog 
#note the reflog id prior to where you made your commit(s)
git reset --hard :reflogid
git checkout oops
git push origin oops