How can I discard modified files?

Solution 1:

A git reset --hard HEAD should solve the problem.

Solution 2:

You can use:

git checkout .

To understand the difference between git checkout and git reset refer to the following question :

What's the difference between "git reset" and "git checkout"?

Solution 3:

It happens because the linux kernel includes files with the same name (but different cases):

include/linux/netfilter/xt_connmark.h 
include/linux/netfilter/xt_CONNMARK.h

Solution 4:

By entering these commands in succession.

git stash
git stash drop

git stash stores modified files on a stack for later retrieval.

git stash drop discards them.

Solution 5:

To restore:

modified: specific_filename

git checkout <specific_filename>

It's safer than removing all files at once using git checkout ..