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
You could use
git add -p
to stage the chunks that you want to keep in a particular file, then
git checkout --
to discard the working tree changes that you didn't want to keep, by checking out the staged version of the file.
Finally, you can use
git reset --
to revert the staged version of the file to the most recent committed version of the file to leave you with your changes unstaged.