I am still a beginner at git, and it was just a stupid mistake I made, long story in one sentence. I was not in a subfolder as @gaoagong reported, but the other way round, in a parent folder. Strange enough, I did not get the idea from that answer, instead, the idea came up when I tested git add --all
, see the long story below.
Example in details.
Actual repo:
The Parent folder that I had opened mistakenly on parent level (vscode_git in my case):
I had cloned a repo, but I had a parent folder above this repo which I had opened instead, and then I tried adding a file of the subfolder's repo with git add 'd:\Stack Overflow\vscode_git\vscode-java\.github\ISSUE_TEMPLATE.md'
, which simply did nothing, no warning message, and the git status
afterwards said:
nothing added to commit but untracked files present (use "git add" to track)
Running git add --all
gave me the yellow notes:
warning: adding embedded git repository: vscode-java the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
git submodule add vscode-java
hint: If you added this path by mistake, you can remove it from the index with
git rm --cached vscode-java
See "git help submodule" for more information.git
To fix this, I reverted the git add --all
with git rm --cached -r -f -- "d:\Stack Overflow\vscode_git\vscode-java" rm 'vscode-java'
:
Then, by simply opening the actual repo folder instead,
the git worked as expected again. Of course the ".git" folder of the parent folder could be deleted then:
cd
'd into a dir. Had to cd back to root dir to makegit add .
work.