关联分支
用idea创建一个新分支
新建test分支
把test分支推送到远程
此时pull代码,虽然远程已经有了test分支,但是默认还是会从master拉取
此时我们就需要做分支关联
切换到命令行,参看分支的关联关系
git branch -r 参看远程分支
git branch -a 参看本地及远程分支
git branch -vv 参看本地分支和远程分支的关系
本地新建的分支和新建远程分支进行关联,有2中方式
下面我们以第一种方式进行关联
然后解除关系
再用第二种方式关联
git branch -u origin/test 本地和远程test关联
返回:Branch 'test' set up to track remote branch 'test' from 'origin'.关联成功
git branch --unset-upstream 当前本地分支与远程关系解除
再次绑定
git branch --set-upstream-to origin/dev-caoke
返回:Branch 'test' set up to track remote branch 'test' from 'origin'.关联成功