我用git fetch <remote> --depth=<N>
避开超时问题添加远程到我的本地存储库。尝试git fetch <remote>
没有指定深度会超时。所以我尝试了git fetch <remote> --depth=10
,然后反复多次,每次都稳步增加深度,直到我终于能够获得整个事物(即增加深度检索零对象)。之后我跑git fetch <remote> --unshallow
其中is supposed to convert the remote back to a non-shallow remote copy。与每个提取后更改远程分支git问题
这是我的问题。完成所有这些之后,我不确定我的本地存储库是否处于相同/相同状态,如果我刚开始时完成了git fetch <remote>
,并且没有超时。每次我git fetch <remote>
它不断报告相同的“新”和“更新”分支。
发生了什么,我该如何纠正?
我唯一能想到的尝试就是我没有真正尝试过,就是删除远程并重新添加它。我害怕不得不重新开始。这是一个非常大的存储库,需要很长时间才能达到这一点。如果我在此期间避免了git gc
,将删除并重新添加远程分支,而无需再次下载所有提交?
以下是我所做的和结果。
每次我git fetch <remote>
现在,不管我怎么努力,我得到这样的输出:
Fetching <remote>
From ssh://<url>
+ 3603285...775e0fe Feature/A -> <remote>/Feature/A (forced update)
+ 6303337...de89a23 Feature/B -> <remote>/Feature/B (forced update)
* [new branch] feature/C -> <remote>/feature/C
* [new branch] feature/D -> <remote>/feature/D
* [new branch] feature/E -> <remote>/feature/E
* [new branch] feature/F -> <remote>/feature/F
* [new branch] feature/G -> <remote>/feature/G
* [new branch] feature/H -> <remote>/feature/H
同样的输出每次。其他遥控器并不像这样。它只出现在这个远程,分支指针实际上从来没有实际进展,每个fetch
试图再次推进它们。输出中永远不会有任何实际的错误。
我已经验证这些分支都存在于远程服务器中,并且不会在那里删除。但是,检查远程回购的分支Feature/A
的整个提交历史记录,它根本不包含提交3603285
。
git config --get remote.<remote>.fetch
:
+refs/heads/*:refs/remotes/<remote>/*
部分输出的git remote show <remote>
:
Remote branches:
feature/X tracked
feature/Y tracked
feature/A tracked
feature/B tracked
refs/remotes/<remote>feature/C stale (use 'git remote prune' to remove)
refs/remotes/<remote>feature/D stale (use 'git remote prune' to remove)
refs/remotes/<remote>feature/E stale (use 'git remote prune' to remove)
refs/remotes/<remote>feature/F stale (use 'git remote prune' to remove)
refs/remotes/<remote>feature/G stale (use 'git remote prune' to remove)
refs/remotes/<remote>feature/H stale (use 'git remote prune' to remove)
事情我已经试过这没有纠正这一点,
git fsck
(未报告任何问题)git fetch <remote> --unshallow
(报告资料库已经完成)git gc
(没有错误报告,运行两次产生相同的输出)git remote prune <remote>
(删除分支C
到H
,但他们加了回去未来fetch
)git fetch --all --prune
的git fetch --all --prune
输出是有点不同(也每一次,不管我怎么努力):
Fetching <remote>
From ssh://<url>
x [deleted] (none) -> <remote>/Feature/C
x [deleted] (none) -> <remote>/Feature/D
x [deleted] (none) -> <remote>/Feature/E
x [deleted] (none) -> <remote>/Feature/F
x [deleted] (none) -> <remote>/Feature/G
x [deleted] (none) -> <remote>/Feature/H
+ 3603285...775e0fe Feature/A -> <remote>/Feature/A (forced update)
+ 6303337...de89a23 Feature/B -> <remote>/Feature/B (forced update)
* [new branch] feature/C -> <remote>/feature/C
* [new branch] feature/D -> <remote>/feature/D
* [new branch] feature/E -> <remote>/feature/E
* [new branch] feature/F -> <remote>/feature/F
* [new branch] feature/G -> <remote>/feature/G
* [new branch] feature/H -> <remote>/feature/H
如果我退房分支<remote>/Feature/A
我得到承诺3603285
不775e0fe
,即使在远程服务器上,Feature/A
点775e0fe
和3603285
是无处在它的历史。我也可以通过提交字符串直接检查出775e0fe
,没有问题。命令该序列产生令我感到奇怪的输出(也每一次,不管我怎么努力):
$ git checkout <remote>/Feature/A
HEAD is now at 3603285
$ git checkout -b Feature/A
$ git merge 775e0fe
Already up-to-date.
我以前在使用案例折叠的系统上看到过这种行为。我看到你在这里有'feature/'和'Feature/',这里有小写字母和大写字母F.如果这是同样的问题,就是这样。你的Git认为它必须销毁错误的分支并创建正确的分支,但是你仍然有错误的名称,因为你的操作系统会折叠大小写并将所有内容写入现有的其他大小写目录。解决方案是使用不折叠大小写的OS(或文件系统),或者修复上游以使用单个大小写。 –
torek
@torek这是完全正确的。远程回购包含具有不同提交的'Feature/A'和'Feature/B'的大小写版本。并且所有'[删除的]'分支都被修剪为'特征/ ...',然后以小写形式添加回'特征/ ...'。添加您的解决方案并作为答案,我会接受它。 – wberry