You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Justin Sanderson edited this page Oct 2, 2026
·
1 revision
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
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]