How do I delete unpushed git commits?

Question

I accidentally committed to the wrong branch. How do I delete that commit?

Answer

Delete the most recent commit, keeping the work you've done:

git reset --soft HEAD~1

Delete the most recent commit, destroying the work you've done:

git reset --hard HEAD~1

Need to reset git branch to origin version

List Git aliases