user794846
user794846

Reputation: 1931

Git how to add a new separate remote repository for a branch

Ok we currently have a git repository set up on our server with several branches dev, staging, master etc. We are able to push and pull from our local machines to the remote server.

The company however wants to add an additional team of developers that work in another country but they are not to be allowed access to our main git repository. They have their own server and have set up a git repository for us on that. The plan is to push a copy of the dev branch to their remote repository which then can then use. When they make changes we want to be able to pull their changes down review the code then merge the changes into our dev branch and push to our repository.

What is the best way to achieve this? Do I just need to make a new copy of the dev branch and add a remote upstream to that branch?

Upvotes: 0

Views: 32

Answers (1)

phd
phd

Reputation: 94511

You cannot add a remote repo just for a branch. But you don't need to. You add a remote and push your dev branch there. That's all. You just need to be careful to never push other branches there. You can create a pre-push hook to prevent leaking other branches.

Upvotes: 1

Related Questions