Vikas Gupta
Vikas Gupta

Reputation: 21

How to link two repositories on Github?

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

Answers (1)

VonC
VonC

Reputation: 1324278

There is no "automatic sync" between repo in Git or GitHub.

One possible implementation is:

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

Related Questions