Reputation: 21
I have a repository Named as "R1". This repository contain 4 Projects (P1,P2,P3 and P4).
I want to Link P1 with another repository R2 same P2 with R3. If I push the code on Repository R1 then it should be push for all linked repositories(R2 and R3).
Please suggest me if this is possible using GitHub.
Upvotes: 2
Views: 8815
Reputation: 1324278
There is no "automatic sync" between repo in Git or GitHub.
One possible implementation is:
P1
or P2
are in their own git repo (pushed to their respective GitHub repo)declare P1
and P2
as submodule of R1
, with a directive for them to follow a branch (like master)
git submodule add -b master [URL of P1] P1/
That means, when you push anything in P1
or P2
, or all you need to do in R1
or R2
is:
git submodule update --remote
git add .
git commit -m "new SHA1 for P1 or P2"
git push
R1
only monitors gitlinks (special entries in the index) for P1
or P2
.
However that means more repos that you currently have: you had R1
and R2
, you would need P1
and P2
as repos as well.
Upvotes: 1