Question

I have a Github repository and a private internal repository. Currently, we just add the two repo references n the git/config file of the repositoy, both as the remote origin. So, when we push changes, they go to both repos. We started doing this as a redundancy policy.

However, we started using the pull requests. The main objective behind this is: a inexperienced dev forked the main repo, made changes, tested them, pulled them to their repos and then pull-requested them to the main repo. A more experienced developer would review these changes and merge or not into the main repo. However, in a first test, this caused the repos to go out of sync.

Is there any way to keep them synced? I also would appreciate protips for a better approach or better practices.

Was it helpful?

Solution

One solution is to only push or contribute to the private internal repository and then install a git hook in the private internal repository push the commits it received to the Github repo.

A good reference, to start with for git hooks can be found here.

The downside of this solution is that you'll have to make sure to never modify your public github repo. If your public github repo does get pull requests, you'll have to add those commits by pushing them to your private repo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top