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

相关文章
相关标签/搜索