简体   繁体   中英

Make a folder both a symlink and a git submodule

This my project structure in a nutshell:

 + A
 | + some content
 |
 + B
   + A

I want in my main git repo a submodule in B that points to A . But since the A project contains the main method, I want to be able to quickly test before committing, so I'd like a symlink (or rather a mklink since I'm on windows) that points to A so it gets updated without committing.

The problem is that A doesn't have just "some content".
It also has a .git subfolder in it, which a submodule does not.

If you can, use git worktree in order to checkout a branch in a separate folder (than the original A cloned folder)

Then you can try and use a symlink from B subfolder to A , after adding A as a submodule in B .
Note: since Windows 10 build 14972 (Dec. 2016) , symlinks ( mklink ) can be created without needing to elevate the console as administrator.


A better approach is described in " Git: Possible to use same submodule working copy by multiple projects? ".

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