git restore --staged --worktree file.txt

Category: Git - Core

git restore --staged --worktree file.txt

Restore a file in index and working tree

Resets the file in the index, unstaging it, and in the working tree, discarding local edits, in one move. It returns the file to its state in the last commit. Be careful: local changes to that file are lost.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.