git branch --set-upstream 本地关联远程分支

Posted sundaysgarden

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git branch --set-upstream 本地关联远程分支相关的知识,希望对你有一定的参考价值。

https://www.jianshu.com/p/403d6ad11e30

 

 

 

最近使用git pull的时候多次碰见下面的情况:

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

其实,输出的提示信息说的还是比较明白的。

使用git在本地新建一个分支后,需要做远程分支关联。如果没有关联,git会在下面的操作中提示你显示的添加关联。

关联目的是在执行git pull, git push操作时就不需要指定对应的远程分支,你只要没有显示指定,git pull的时候,就会提示你。

解决方法就是按照提示添加一下呗:

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

其中,origin/remote_branch是你本地分支对应的远程分支;your_branch是你当前的本地分支。



作者:ios开发到汽修
链接:https://www.jianshu.com/p/403d6ad11e30
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

以上是关于git branch --set-upstream 本地关联远程分支的主要内容,如果未能解决你的问题,请参考以下文章

Git新建本地分支与远程分支关联问题:git branch --set-upstream

git branch --set-upstream 本地关联远程分支

yocto编译时报错"fatal: the '--set-upstream' option is no longer supported. Please use '-

yocto编译时报错"fatal: the '--set-upstream' option is no longer supported. Please use '-

GIT-如何跟踪远程分支

text git set-upstream