1) I did git init in a folder
2) added some project files
3) I did git add * so it added recursively all files
4) I realised that I added a bunch of files I don’t want to be versioned, so I wanted to undo the add
5) git reset gives me the following error:
fatal: Failed to resolve 'HEAD' as a valid ref.
6) git status still shows all the added files
7) I tried git reset --hard HEAD and I got the following error:
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
8) git status still shows all the added files
What should I do at this point?
would be the right command to remove from the index the file you don’t want to commit.
Any
resetcommand won’t work, since you have to any commit yet in your newly created repository.From the
git rmman page: