Undo the last commit
April 4, 2023To undo the last commit, discarding the changes:
git reset --hard HEAD~1
To undo the last commit, keeping the changes:
git reset HEAD^
OR
git reset --soft HEAD~1
To undo the last commit, discarding the changes:
git reset --hard HEAD~1
To undo the last commit, keeping the changes:
git reset HEAD^
OR
git reset --soft HEAD~1