- To UNDO local file changes but NOT REMOVE your last commit, then use
git reset --hard
- To UNDO local file changes AND REMOVE your last commit, then use
git reset --hard HEAD^
or
git reset --hard HEAD~
- To KEEP local file changes and REMOVE ONLY your last commit, then use
git reset --soft HEAD^
or
git reset --soft HEAD~
Use git status and git log frequently to observe your current state.