How do I discard unstaged changes in Git?

Readonly picture Readonly · Sep 9, 2008 · Viewed 2.8M times · Source

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

Answer

Tobi picture Tobi · Sep 9, 2008

For all unstaged files in current working directory use:

git checkout -- .

For a specific file use:

git checkout -- path/to/file/to/revert

-- here to remove argument ambiguation.