开发者

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

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 pu开发者_Python百科ll from Heroku to my local branch 'develop' ?

Thanks.


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.


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.


When you pull you have to specify which remote branch you want to pull from. It doesn't make any sense to pull from just "heroku" because it may have multiple branches and Git doesn't know which one you want.

If there is only one branch on your remote then it's probably called "master". Try:

git checkout develop
git pull heroku master

This puts you into your local "develop" branch then pulls the "master" branch from the repository called "heroku".


As of this writing, the command git pull provides the answer. When I try to git pull without any further arguments, it provided me the following information:

rockyinde.desktop% git pull
remote: Counting objects: 143, done.
remote: Compressing objects: 100% (95/95), done.
remote: Total 143 (delta 75), reused 87 (delta 23)
Receiving objects: 100% (143/143), 29.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (75/75), completed with 33 local objects.
From ssh://git.rockyinde.com:<port>/code/myproject
   2d232ds..1hw1f84  frontline   -> rockyremote/frontline

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

   git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

   git branch --set-upstream-to=<remote>/<branch> develop

So, all you need to be looking at (in the above output) is:

From ssh://git.rockyinde.com:<port>/code/myproject
   2d232ds..1hw1f84  frontline   -> rockyremote/frontline

which specifies your remote/branch information. And so, in my case it is:

git pull rockyremote frontline
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜