开发者

How to handle shared files and folders vis symbolic link within a git repository

开发者 https://www.devze.com 2023-04-11 04:37 出处:网络
I have project I want to store in a 开发者_JAVA技巧git repository and put into github where the substructure of the tree currently has a symbolic link shared folder for common code (contained within t

I have project I want to store in a 开发者_JAVA技巧git repository and put into github where the substructure of the tree currently has a symbolic link shared folder for common code (contained within the tree - not outside of the tree) between top level folders and the tree.

Example:

.                  - top level project for repo where .git lives
folderA            
  sharedFolder     - real folder
folderB
  sharedFolder -> ../folderA/sharedFolder  - symbolic link folder to avoid duplicate files

Can this be done and how?

I would consider making the content of the sharedFolder its own git repo if that makes for a solution where I can still avoid duplicating code between the content needed in folderA and folderB - if I do that, how would setup the two git repos for this scenario?


If you put sharedFolder in its own git repository, you can do git submodule add sharedFolder in each repository that uses it.

For more information, you should look up the git submodule command.

Github has more information about submodules here.

0

精彩评论

暂无评论...
验证码 换一张
取 消