bob.sacamento
bob.sacamento

Reputation: 6651

How to delete the most recent git commit?

I can't believe I'm the first one to ask this, but my searching through git questions hasn't given me the precise answer I need, so: I just made a commit on the master branch and I realize that it is buggy and won't be ready for prime time without alot of work, so I just want to get rid of it. How do I do this? git reset --hard HEAD and git reset --hard sha-of-bad-commit don't do anything except move the HEAD back to this bad commit.

Upvotes: 0

Views: 67

Answers (1)

Axnyff
Axnyff

Reputation: 9954

You need to target the commit before the wrong commit.

git reset --hard HEAD~

Upvotes: 1

Related Questions