PortMan PortMan - 3 months ago 11
Git Question

How to make my workspace match another commit like "hg revert -r [commit] --all"

Without changing which commit I have checked out, how can I set my entire working directory to a different commit?

In mercurial, I would do this with

hg revert -r [commit] --all
.

Answer

Use git checkout with a path; e.g. '.' for the complete actual working directory:

git checkout <commit-id> -- .