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
More on Undoing changes: reset, revert, restore and reflog
What is the difference between `git reset` and `git revert`?BeginnerHow do you discard changes in one file?BeginnerHow do you recover a commit after `git reset --hard`?IntermediateCan you recover uncommitted changes lost by `git reset --hard` or `git checkout .`?IntermediateWhat does `git commit --amend` do to the reflog and to the old commit?IntermediateHow do you undo `git add` for a file?Beginner