2011-04-01 73 views
38

我想從我的Heroku遠程拉,我得到這個消息:如何做一個特定分支的git pull?

>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 

我的本地分行是「發展」。

我如何從Heroku拉到本地分支'develop'?

謝謝。

回答

34

更新回答:您需要指定要從哪個分支中提取,因爲您的本地分支未配置爲從herokumaster中提取。

所以你可以試試:

git pull heroku master 

請記住,你必須以已簽出develop此命令拉至當地分支機構develop

+0

以及我的遠程被稱爲'heroku'。記住我想要我的本地分支你知道....不是遠程分支。當我做'git pull heroku develop'時,我得到一個致命的錯誤,因爲沒有稱爲develop的遠程分支。我想要做的就是從名爲'heroku'的遠程遠程主分支上拉到我的本地分支'develop'。 – marcamillion 2011-04-01 06:02:00

+0

作爲答案筆記,master是遠程分支。 – RobW 2013-10-06 02:12:37

5

當你拉你必須指定你想從哪個遠程分支拉。從「heroku」拉出來沒有任何意義,因爲它可能有多個分支,Git不知道你想要哪一個。

如果您的遙控器上只有一個分支,那麼它可能被稱爲「主」。嘗試:

git checkout develop 
git pull heroku master 

這會將您置入當地的「開發」分支,然後從名爲「heroku」的存儲庫中拉出「主」分支。

6

注意:如果你想推/從你develop分支默認拉heroku/master,你可以配置它:

git branch --set-upstream develop heroku/master 

您可以檢查develop分支與你的合併策略:

git config branch.develop.merge 
2

在撰寫本文時,命令git pull提供了答案。當我嘗試git pull沒有任何進一步的參數,它爲我提供了以下信息:

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 

所以,你需要尋找在(上述輸出):

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

指定您的remote/branch信息。所以,在我的情況下,它是:

git pull rockyremote frontline