Guided Notes
Undoing Changes
Discarding edits, amending commits, reverting safely, resetting history, and recovering with reflog.
Undoing before you commit
Slide 1 / 5git restore index.html — throw away unstaged edits to a file (they can't be recovered). git restore --staged index.html — unstage a file, keeping the edits. git clean -n — list untracked files; git clean -f deletes them.
When in doubt, run git status first — it prints the exact commands to undo each kind of change.