git discard all unstaged changes

# Discard all unstaged changes (current directory and below)
git restore .

# Discard changes in a specific file only
git restore src/app.ts

You edited files but want to throw away the changes and revert to the last committed state.

Old syntax (git < 2.23)

git checkout -- .           # same as git restore .
git checkout -- src/app.ts  # specific file

Discard staged changes (unstage + discard)

git restore --staged .      # unstage all
git restore .               # then discard unstaged

Preview what would be discarded first

git diff                    # shows unstaged changes before discarding