How to undo git add before first commit —28 December 2013
Normally I undo git add somefile
with git reset somefile
.
However, if you’re before the first commit, this won’t work:
$ git reset somefile
fatal: Failed to resolve 'HEAD' as a valid ref.
The solution:
$ git rm --cached somefile
rm 'somefile'
$ git status -s somefile
?? somefile