git checkout — .
If however you are referring to a specific existing file, simply add the file path as follows :
git checkout — thepathtothefile/to/discard
Read: Git Fetch vs Pull
For newer Git releases however you would want to use the restore command :
git restore . [Git discard changes command]
And for a specific file :
git restore thepathtothefile/to/discard [Git revert changes for a file]
Answer due to Tobi.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.