Reputation: 2645
For my thesis, I have a Git repository repo_0
which contains a number of subdirectories. Something like:
thesis/
.git/
data/
experiments/
papers/
algorithm_1/
algorithm_2/
I'm the only person with access to the repository. However, I would like to share algorithm_1
and algorithm2
with more people so that they can eventually contribute.
How can I link algorithm_1/
and algorithm_2/
to their own repositories repo_1
and repo_2
while keeping them also in repo_0
?
A naive solution would be to get the algorithms out of repo0
and maintain three repositories, but I'm looking for a lazier solution where:
repo_0
, changes in algorithm_n
propagate to repo_n
and repo_2
repo_1
, changes propagate to repo_0
What would do suggest as the closest solution?
Upvotes: 1
Views: 37
Reputation: 10931
This is a prime example where submodules are great. You treat each repository as their own repo (maintain three repos) but have essentially "soft links" to a specific commit in your repo_0 to your other repos. This works as if the submodules are remote repositories but you keep the local copy with your repo_0.
Check out this great tutorial on this topic.
Upvotes: 1
Reputation: 12415
What you need is a submodule.
http://git-scm.com/docs/git-submodule
Upvotes: 1