Reputation: 315
I'm developing a Virtual Assistant solution to be used within my organization. I have cloned the Microsoft AI repository from GitHub.
The AI repo is updated regularly with new features which I want to take advantage of.
This is what I want to accomplish:
So:
I have tried to look for a Git strategy for this situation, but I haven't found any good suggestion of how to do.
Any suggestions?
Upvotes: 2
Views: 2332
Reputation: 12905
Perhaps the confusing aspect of forking is the term "origin." When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote, typically named "upstream:"
git remote add upstream git://github.com/user/repo.git
Your process then becomes clear: you fetch from upstream, and push/pull into origin. When all set up, 'git remote -v` will show something like this:
`origin https://github.com/your_repo/AI.git (fetch)
origin https://github.com/your_repo/AI.git (push)
upstream https://github.com/Microsoft/AI.git (fetch)
upstream https://github.com/Microsoft/AI.git (push)`
See other more in-depth answers on this and related topics: What is the difference between origin and upstream on GitHub? and Definition of "downstream" and "upstream"
Upvotes: 3
Reputation: 463
The easiest way to do this is a fork, sometimes that isn't what you want. What I do in this situation:
Create my repo (in GitHub, GitLab, etc.) with a README
Clone my repo locally
Add a remote to the repo I want code from (I usually call this upstream)
git remote add upstream [email protected]/whatever
Pull from the remote
git pull upstream master
Push to my repo
git push origin master
Upvotes: 2