GIT Restore - jsanderson104/GIT-CheatSheet GitHub Wiki

Let's say you modified 2 files and you did a git add .

You changed your mind and now don't want one of the files you added to go into the next commit.

This is where git restore is used. Doing a git status right now will tell us the below command as help.

There are essentialyl 2 methods of git restore

  1. Undo the changes to a file after a git add AND before a git commit *This method will just undo the changes to the file contents. git restore [filename]