DEV Community

Gunabalan.S
Gunabalan.S

Posted on • Edited on

Deleting the Last Commit Locally Before Pushing to Remote

git reset --soft HEAD~
Enter fullscreen mode Exit fullscreen mode

C:\Projects> git reset --soft HEAD~
fatal: Cannot do a soft reset in the middle of a merge.

git reset --hard HEAD~

Enter fullscreen mode Exit fullscreen mode

HEAD is now at f1sssebd

Note: reset --hard will delete local changes

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more