Lesson 18 / 28
Discarding File Changes
Discard uncommitted edits and unstage files safely with git restore.
Restore a file
Reverts a file in the working directory back to its last committed state — destructive, uncommitted edits are gone.
git restore config.js
# older equivalent:
git checkout -- config.jsUnstage a file
Moves a file back from staged to unstaged without touching its content.
git restore --staged config.js