Removing all files from the just initialized git repository staging area

Say I just created a repo

git init

and then did

git add .

Then i did

git status

and noticed that there were several files that I did not want. I went in .git/info/and added these files to the file exclude. Then i tried

git reset .

but got

fatal: Failed to resolve 'HEAD' as a valid ref.

Attempt

git reset --hard

had the same effect. I think this is because I still did not commit? How can I achieve the same effect on a new, uncompromising repo, then?

thank

+5
source share
2 answers

: , , , - , , , , .

, , .

git add ., "" . , . git status, , :

 # Changes to be committed:
 #   (use "git rm --cached <file>..." to unstage)

... , , foo.txt bar.c, :

git rm --cached foo.txt bar.c

:

git commit

... .


, , , - , grzuy,

git rm -r --cached .

... git add filename.

+16

:

git rm -r --cached .
+5

All Articles