How to undo git local commit(s)

Before pushing changes if you want to change last commit(s)

Soft reset

git reset HEAD~

Your files are left as is, you can now modify, commit and push.

Hard reset

git reset --hard HEAD~

Your files will get reset to HEAD.

 Share!