I am working with a customer who provided git branch access to get the latest src code. I've to continue working with that src code.
But my company won't allow me to commit the src code directly to their branch. And so, my company provided with our own repository account to commit the additions/modifications/deletions etc.
I would like to know if we can branch my customer's src code into our repository so that at the end of the project I can merge with customer's code easily. May be just by a pull request to customer's server.
Is my understanding correct or is there any other better alternative to achieve the same.
git branch on another server
748 views Asked by Satyam At
2
There are 2 answers
0
On
git
is a distributed version control system by design.
This means, that a workflow, where you pull changes from one server and push them to another server is very well supported.
However, a single commit in git also includes a reference to the entire history of this commit (by means of the commit-hash). This means that the repository you pull from and the repository you push to must share the entire history.
In practice this means, that you cannot just use any existing git-repository of your company, but need to create a new one (git init
) on your company's git server.
If I understand you correctly you are facing the following situation:
remote repository of the customer, lets call it A
your repository of your company, lets call it B
You pulled from A
git pull A branchName
And you want to put your changes to the
B
-repository:git remote add B /url/to/B/repo.git
Than you can easily push to B
git push B yourChangesToBranchName
Now you are able to pull in changes from A and push them to B without any interfering problems. Hope this is what you want.