Ways to undo changes git reset --soft HEAD~1Undo last commit, keep changes staged.git reset HEAD <path>Unstage changes for a specific file or filesgit checkout -- <path>Restore a file in the working directory to the version from the current branch or index.git reset --hard HEAD~1Undo last commit and discard changes.git revert <commit>Revert the changes introduced by a specific commit