How to pull only one branch from remote?

Can I assign my own "git pull/push" remote address to one specific branch?

  • I mean, the other branches have their different remote addresses.

  • Answer:

    Yes you can. Assuming you have already set up the branches and remotes, it's as easy as: git branch --set-upstream local_branch remote/remote_branch I think --set-upstream was added in version 1.7.0 of git.

Dennis Schön at Quora Visit the source

Was this solution helpful to you?

Other answers

Yep. Lets say you wanna add new server with URL "https://github.com/../newRepo.git/" and you wanna push from branch "DifferentRepoBranch" to this repo. First add the remote server git remote add NewRepo https://github.com/../newRepo.git/ After this when you do git remote, you should see the old one and the new one. Now move to your branch "DifferentRepoBranch" git checkout DifferentRepoBranch Now set the upstream for your new branch to the repo and branch of the new repository. git branch --set-upstream DifferentRepoBranch NewRepo/DifferentRepoBranch Now play with it.

Karthikeyan Ravi

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.