git关联远程分支


Git在本地新建分支, push到remote服务器上之后,再次pull下来的时候,如果不做处理会报以下提示:


#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> master

原因分析:
本地新建一个分支后,必须要做远程分支关联。如果没有关联,git会在下面的操作中提示你显示的添加关联。关联目的是如果在本地分支下操作: git pull, git push ,不需要指定在命令行指定远程的分支。

解决方法


#git branch --set-upstream-to=origin/master master

Branch master set up to track remote branch master from origin.


#git branch --set-upstream master origin/master

The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to

Branch master set up to track remote branch master from origin.

参考资料:
http://blog.csdn.net/hshl1214/article/details/51074206
https://my.oschina.net/u/219482/blog/285584
http://blog.sina.com.cn/s/blog_63eb3eec0101fgex.html