git branch --set-upstream 本地關聯遠程分支

最近使用git pull的時候屢次遇見下面的狀況:git

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=origin/<branch> release

其實,輸出的提示信息說的仍是比較明白的。this

使用git在本地新建一個分支後,須要作遠程分支關聯。若是沒有關聯,git會在下面的操做中提示你顯示的添加關聯。code

關聯目的是在執行git pull, git push操做時就不須要指定對應的遠程分支,你只要沒有顯示指定,git pull的時候,就會提示你。orm

解決方法就是按照提示添加一下唄:ci

首先經過:git branch --all 查看全部分支,找到遠程的分支,rem

git branch --set-upstream-to=origin/remote_branch  your_branch

其中,origin/remote_branch是你本地分支對應的遠程分支;your_branch是你當前的本地分支。it

相關文章
相關標籤/搜索