0 votes
1 view
in Devops and Agile by (29.3k points)

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

1 Answer

0 votes
by (50.2k points)

Use this command to delete all your work and unpushed git commits use 

git reset --hard HEAD~1

And there is one more option --soft which will delete the recent commit and it doesn’t do anything to your work.

Refer: https://git-scm.com/docs/git-reset#Documentation/git-reset.txt---hard

Welcome to Intellipaat Community. Get your technical queries answered by top developers !