Reputation: 6039
My company purchased a license to certain software. The license includes access to the product's github account so we can get real-time updates by fetching code directly from the repository.
Additionally, we also develop new functionality for this software in-house, and for that we have created a new git account (cloned from the original) that has our version of the code.
What's the best way to merge the code from the product's original repo to our code? Currently the two repositories are configured as different remote repositories.
Upvotes: 0
Views: 65
Reputation: 60143
Assuming upstream
is the name of the upstream remote and that you want to merge in its master branch, I think it should be as simple as:
#fetch upstream changes
git fetch upstream
#go to the branch where you'll integrate them
git checkout your_development_branch
#merge in upstream changes
git merge upstream/master
#push the result to your remote
git push origin your_development_branch
Upvotes: 3
Reputation: 388
Generally speaking, use different ref names that the original repo uses. For example, if they use master
and dev
use main
and next
respectively. From there, it is just a matter of setting up a service which maintains state and continually pulls data from the upstream repository.
Depending on your company's needs, you may or may not want to wantonly merge code from the upstream source. Many companies prefer to do copyright scans of code they ingesting before commingling it with their own intellectual property.
Generally a pattern like pull original, scan content, repudiate/resolve copyright issues, merge into ingestion branch, merge ingestion branch into development branch, etc. is established.
Upvotes: 1