It’s very easy to reset files that have not yet been committed to git.

Reset a single file

1
git reset <filename>

You can also specify the filename as the path to the file, like so:

1
git reset ./the/actual/relatvive/path/with/filename.ext

This will checkout the file from HEAD.

It is important to note that should you have a file that is the same name as a branch, you will need to rather run the following command:

1
 git reset -- <filename>

Reset an entire branch

To reset an entire branch, you can reset it directly against the HEAD.

1
git reset --hard HEAD