Explore Courses Blog Tutorials Interview Questions
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.


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

28.4k questions

29.7k answers


94.2k users

Browse Categories