git restore .
Reverts all uncommitted changes in the current directory.
This command discards all uncommitted changes in the current directory and returns the files to the state of the last commit.
It's a shorthand for git checkout -- .
, where the --
specifies that the .
is a path, not a branch.
The command only affects tracked files; new files created since the last commit will be left unchanged. To include untracked files, use the -u
or --include-untracked
flag like so: git restore -u .