NullVoxPopuli NullVoxPopuli - 4 years ago 315
Git Question

How do I delete unpushed git commits?

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

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download