How do you completely clear the files staged as a result of a "git add ."?

57 Views Asked by At

When trying to add files to push to a git repo, I accidentally added other folders, and I can't for the life of me figure out how to clear the staging queue.

I've tried git reset, but the files are still staged. I've tried git rm --cached, but I get

fatal: No pathspec was given. Which files should I remove?

I tried git rm -r --cached, but that also gives

fatal: No pathspec was given. Which files should I remove?

I can't find any working technique whatsoever across the internet, and would greatly appreciate any and all help. Thank you.

1

There are 1 best solutions below

0
Error In Code On

You can use Git Reset . as in This answer (Note the space before the period, this will restore all files).

Or Git Restore --staged as in This answer. Either one should do the job.