If you are at the root of your working directory, you can do git checkout -- .
to check-out all files in the current HEAD and replace your local files.
You can also do git reset --hard
to reset your working directory and replace all changes (including the index).
Other way which I found useful is:
git checkout <wildcard>
Example:
git checkout *.html
More generally:
git checkout <branch> <filename/wildcard>
Of course you could use hard reset:
git reset --hard
Additionally I'm using simple method allowing to specify the pattern:
git checkout `git ls-files -m | grep "some pattern"`
So here "some pattern" could be the folder or file name or file extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With