Undoing Things in Git: restore, reset, revert and reflog
Git rarely loses work for good. Pick the right command for what you want to undo and where the change currently lives. Discard uncommitted changes git restore src/cart.js # throw away edits to a file (careful: not recoverable) git restore --staged src/cart.js...