git - Git:--git-dir 将所有文件显示为丢失
问题描述
我有两个具有相同子模块的非常相似的存储库。目录结构:
vss
vss/rcv-nginx
rgw
rgw/rcv-nginx
当从rgw
目录请求状态时(只有它!),它表明所有文件都被删除。其他类似项目不会发生这种情况。
git status 命令来了:
# On vss
peter@peterpc:~/git/vss$ git --git-dir=rcv-nginx/.git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
nothing to commit, working directory clean
# On vss/rcv-nginx
peter@peterpc:~/git/vss$ cd rcv-nginx/
peter@peterpc:~/git/vss/rcv-nginx$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
nothing to commit, working directory clean
# On rgw:
peter@peterpc:~/git/rgw$ git --git-dir=rcv-nginx/.git status
On branch feature-rcv-11870_openresty-nginx
Your branch is up-to-date with 'origin/feature-rcv-11870_openresty-nginx'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitlab/merge_request_templates/Bug.md
modified: .gitlab/merge_request_templates/Feature.md
deleted: .idea/runConfigurations/Render_Dyrka_Configs.xml
...
(all files marked as missing)
# on rgw/rcv-nginx
peter@peterpc:~/git/rgw$ cd rcv-nginx/
peter@peterpc:~/git/rgw/rcv-nginx$ git status
On branch feature-rcv-11870_openresty-nginx
Your branch is up-to-date with 'origin/feature-rcv-11870_openresty-nginx'.
nothing to commit, working directory clean
附言
我已经检查了这个问题(git --git-dir not working as expected)并且我知道解决方法,但问题仍然存在——为什么 git 在类似项目中表现不同?
解决方案
可能是因为之前在这个目录中只有 rcv-nginx 是一个符号链接,后来我把它改成了独立的,但 Git 缓存仍然存在。
推荐阅读
- python - 如何将使用 SqueezeNet 预训练模型的 pytorch 代码转换为 tensorflow
- amazon-web-services - 如何通过 CommaDelimitedList 参数条件化嵌套堆栈创建
- mule - 为什么我无法捕获子流中的错误?
- python - Pandas 行过滤器和特定行和列的除法
- php - 无法连接 Web 服务,凭据被拒绝
- javascript - Javascript范围链继承
- neo4j - 使用 Cypher 约束约束属性值
- amazon-redshift - 在 Oracle SQL 中使用 DATEADD 添加小数小时
- python-3.x - 在 python 中使用 find_element_by_css_selector 时无法定位元素错误
- kubernetes - 一种与正在重新启动的 Pod 通信的方法