How to undo a git add

May 6, 2020

So many times, I've accidentally added a file to be staged for a commit and then I have to frantically Google how to un add a file.

There are a couple types of undos that I typically run into.

  1. Un-staging
  2. Resetting back to the original file before you made changes


// 1. Un-add file from being staged to commit
git reset <file>

// 2. Resets <file> to original before you started making changes
git reset <file>
git checkout <file>