How to discard local modifications in git?

Everybody has their own way of writing code, and there are times when you try out a few ways of creating a functionality or fixing that nasty bug, which is not such a good way of doing it. If you want to discard your current changes, you can do it easily by checking out the modified files.

git checkout modified-file.ext

That's all you need...

...

...

But wait! What if you want to discard more than one file?

git checkout modified-file.ext another-modified-file.ext one-more-modified-file.ext

You can add as many files as you want and not just files. It works with complete directories too.

git checkout ./modified-directory

That's everything in modified-directory.

...

...

But wait! What if you have too many files to discard, and it's taking forever? Do it one by one, or do you want to dump everything?

git checkout .

Yup, a dot... that's all you need.

Note: this method helps you discard any modified files from your working directory, if you have created any new ones, they needed to be removed the good old fashioned way or rm.