[英]How to properly git clone with Windows symlinks pointing to folder in submodule
After some trial and error I noticed that links created with mklink /D Foo ..\\..\\Bar\\Baz\\Foo
(pointing to a another file in the same repo) can be commited and cloned without issues even on macOS. 经过一些试验和错误后,我注意到用mklink /D Foo ..\\..\\Bar\\Baz\\Foo
(指向同一个mklink /D Foo ..\\..\\Bar\\Baz\\Foo
中的另一个文件)创建的链接可以提交和克隆,甚至在macOS上也没有问题。 Unfortunately when this particular link points to a submodule, then Windows behaves odd when cloning. 不幸的是,当这个特定的链接指向一个子模块时,Windows在克隆时表现得很奇怪。 The reason is most likely, that the links stored in the repo are pulled before cloning the submodules. 原因很可能是,在克隆子模块之前,存储在repo中的链接被拉出。 Since the links point nowhere at this particular time they are broken and will stay broken even after the submodule has been cloned. 由于链接在这个特定的时间点无处可见,因此即使在克隆了子模块之后它们也会被破坏并且仍然会被破坏。
One workaround is to del
the particular link and git checkout -- *
to restore it in a working state. 一种解决方法是del
特定链接和git checkout -- *
将其恢复到工作状态。 However I'd like to refrain from doing this manually and I'd like to know whether there is any other way. 但是我想不要手动这样做,我想知道是否还有其他办法。 Something like forcing the submodules to be pulled before the repo itself maybe? 可能会强迫子模块在回购之前被拉动?
However I'd like to refrain from doing this manually 但是,我想不要手动执行此操作
You could implement some kind of post-clone hook , like the one presented in the GitHub project . 您可以实现某种类型的克隆后挂钩 ,就像GitHub项目中提供的那样 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.