2

Is there a way to unstage a file in a git repository with no commits?

If you try doing a git add . on a newly created git repo with no commits, and then try to do a git reset you get the following from git:

Failed to resolve 'HEAD' as a valid ref.

Is there an alternative method?

JamesHalsall
  • 13,224
  • 4
  • 41
  • 66

1 Answers1

7

Stupidly, its right in the git status output:

git rm --cached -r .

JamesHalsall
  • 13,224
  • 4
  • 41
  • 66
  • cheers, although if I had read the output of `git status` or found the second answer on [this question](http://stackoverflow.com/questions/348170/undo-git-add) I would have saved time :) – JamesHalsall Aug 26 '11 at 22:41