Question

I have git repo, I found that when using git log myfile, only files under the root (where the .git folder is) show logs. Doing the same to any file in a sub directory does not show anything. Why?

Similarly, when using git extension, right-clicking a file and clicking "file history", only files in root folder have history. All other files do not have history - it will say "git is not initialized"

Did I miss some settings?

Was it helpful?

Solution

One explanation would be a .gitignore which ignores sub-folders (*/)

That would explain that a git add . or a git status do nothing regarding said subfolders.
(Even though the OP thinks "all files have been added". If they actually are in the index, then the .gitignore rules don't apply, as majioa comments)

Check also your environment variables (GIT_DIR, GIT_WORK_TREE) to see if they are set to anything that could confuse Git in your folder.

Do a git ls-files --stage in the root folder of your repo in order to check for special entries in the index which would explain why sub-folders content are of a different nature (a submodule being one).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top