I'm trying to add a reference from one Git repository to a specific folder from a remote repository.
Example:
repo-1
.
├── a
├── b
└── crepo-2
.
├── A
├── B # this should link to repo-1's `b` folder
└── CEdit 1: To clarify, I'm using Git
1 Answer
This is not possible with git.
Each commit reference is a pointer to a snapshot of the entire tracked file system and so any linking would be to the entire repository and not a portion of it.
The work around would be to make 'folder' b it's own seperate repository. You would then include this in repo-1 and repo-2 as a submodule.
explains submodules in detail.