Is there a command that allows you to partially undo the changes to a file (or files) in the working directory?
Suppose you have edited a file a lot but you realize that
git checkout $file reverts the state of the file $file to the last committed state. I think you can use git checkout SHA-1 -- $file to revert the file to the commit identified by SHA-1.
git checkout $file
$file
git checkout SHA-1 -- $file