How do I discard changes in my working copy that are not in the index?
Kuldeep Baberwal Changed status to publish February 4, 2025
For all unstaged files in current working directory use: git restore .\n\nFor a particular file use: git restore path/to/file/ to/revert.\n\nThe overloaded git checkout (see here) is removed from the argument disambiguation; if a file has both staged and unstaged changes, only the changes shown in GitHub diff are reverted; changes in the file\’s changes are not shown, but are preserved, before Git 2.23 for all files in current working directory: git checkout — .\n\nFor a particular file: git checkout — path/to/file/ to/revert — .\n\nhere to make clear ambiguity (this is called argument disambiguation).