简体   繁体   中英

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. Unfortunately when this particular link points to a submodule, then Windows behaves odd when cloning. The reason is most likely, that the links stored in the repo are pulled before cloning the submodules. 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. 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 .

  • Advantage: you can then script in that hook the deletion/recreation of the buggy symlink.
  • Inconvenient: that is a local configuration, meaning anyone else must do the same locally to automate that process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM