[英]git: changes ignored in sub-directory
I have a sub-directory in my repo that stopped tracking changes.我的 repo 中有一个子目录停止跟踪更改。 I can add abc.php file to any directory above a certain level and git status
returns the expected results, but once I add abc.php to the subdirectory in question (or change an existing file), git status
comes up empty.我可以将 abc.php 文件添加到某个级别以上的任何目录,并且git status
返回预期结果,但是一旦我将 abc.php 添加到相关子目录(或更改现有文件), git status
就会变为空。 I believe the subdirectory used to have it's own git repo, but I could be wrong.我相信子目录曾经拥有自己的 git repo,但我可能是错的。
I see that git update-index --really-refresh
may be an option , but I'm concerned because I added other git projects to "sibling" directories to the one having an issue.我看到git update-index --really-refresh
可能是一个选项,但我很担心,因为我将其他 git 项目添加到了有问题的“兄弟”目录中。 (I didn't do anything within my parent repo to acknowledge these, so hope that's okay too.) (我没有在我的父仓库中做任何事情来承认这些,所以希望这也没关系。)
That is, I have也就是说,我有
Every parent directory in dir and above has no issues and works as expected. dir 及以上的每个父目录都没有问题并且按预期工作。
My primary question: should I be concerned about running this given the above structure?我的主要问题是:鉴于上述结构,我应该担心运行它吗? I'd also like to ask if there's anything I should do with the repos within the primary repo (ie somehow declare them as submodules)?我还想问一下,我应该对主 repo 中的 repos 做些什么(即以某种方式将它们声明为子模块)?
Thanks.谢谢。
Okay well I needed to run the following two commands to get it working:好吧,我需要运行以下两个命令才能使其正常工作:
git rm --cached path_to_subdir (no trailing slash)
git add path_to_subdir/*
Based on the messaging I was seeing when trying to run the command in my original post ( git update-index --really-refresh
), there used to be a git repo in the sub-directory that was not removed properly , and was never declared as a sub-module.根据我在原始帖子 ( git update-index --really-refresh
) 中尝试运行命令时看到的消息, git update-index --really-refresh
曾经有一个 git repo 未正确删除,并且从未被删除声明为子模块。
2 possibilities: 2 种可能性:
.gitignore
file in any parent directory)目录本身被忽略(在任何父目录的.gitignore
文件中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.