Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I do a git pull to a specific branch?

Tags:

git

I am trying to pull from my heroku remote, I get this message:

>git pull heroku You asked to pull from the remote 'heroku', but did not specify a branch. Because this is not the default configured remote 

My local branch is 'develop'.

How do I pull from Heroku to my local branch 'develop' ?

Thanks.

like image 366
marcamillion Avatar asked Apr 01 '11 05:04

marcamillion


People also ask

How do I pull a request to a specific branch?

As of 15.08. 2016 GitHub allows changing the target branch of a pull request via the GUI. Click Edit next to the title, then select the branch from the dropdown. You can now change the base branch of an open pull request.

How do I pull from a specific branch remote?

If you have a single remote repository, then you can omit all arguments. just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.


2 Answers

Updated answer: You need to specify what branch you want to pull from, since your local branch is not configured to pull from heroku's master.

So try something like:

git pull heroku master 

Remember that you have to have checked out develop in order for this command to pull to the local branch develop.

like image 77
Chetan Avatar answered Oct 12 '22 14:10

Chetan


Note: if you want to push/pull by default to heroku/master from your develop branch, you can configure it with:

git branch --set-upstream-to develop heroku/master 

You can check your merge policy on the develop branch with a:

git config branch.develop.merge 

Note: As commented by Animay, since Git 1.8, --set-upstream is renamed --set-upstream-to.
--track is also possible, although slightly different.

like image 40
VonC Avatar answered Oct 12 '22 16:10

VonC