I have created a Git repository locally by using the command git init.
Then mistakenly added all files for staging by entering git add .
But I want to unstage some files which I don’t want to commit.
But when I enter git restore --staged <file/folder name>, it states the following:
fatal: could not resolve HEAD
I figured out this occurred due to my branch main having no commits yet. So, is it possible to exclude some files from staging before I can commit? If so, how can I achieve it?
>Solution :
Try git reset to remove all files from stage or git reset /path/to/file