Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

What are the three modes of `git reset`?

BeginnerConceptUndoing changes: reset, revert, restore and reflog
Answer

--soft moves only the branch pointer, leaving index and working tree. --mixed (default) moves the branch and resets the index, keeping working files. --hard resets all three, discarding uncommitted changes.

git reset --soft HEAD~1    # undo commit, keep staged
git reset HEAD~1           # undo commit, keep unstaged
git reset --hard HEAD~1    # undo commit and changes
All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog