version-control - git remove modified files - How do I discard unstaged changes in Git?

View 3+ more / git

How do I discard changes in my working copy that are not in the index?

Venkat



Answer #1

So, in order to discard unstaged changes in a tracked file, you can now do:

git restore <file>

To discard all unstaged changes in the tracked files in the current directory (this is recursive), you can run:

git restore .
git clean -df