1、问题:用小乌龟pull的时候git报错了,并提示没有指定分支
2、原因:就是本地分支和远程分支不同或是未指定。
3、解决:
方法一:
使用以下代码
git push -u
效果:提示已跟踪,就可以了
方法二:
设置push.default为matching
push.default在Git 2.0之前,这个属性的默认被设为'matching',2.0之后则被更改为了'simple'。
我们可以用git version来确认git版本
用git config --global push.default 'option'来改变push.default默认行为
push.default 有以下几个可选值:nothing, current, upstream, simple, matching
nothing - push操作无效,除非显式指定远程分支,例如git push origin develop(我觉得。。。可以给那些不愿学git的同事配上此项)。 current - push当前分支到远程同名分支,如果远程同名分支不存在则自动创建同名分支。 upstream - push当前分支到它的upstream分支上(这一项其实用于经常从本地分支push/pull到同一远程仓库的情景,这种模式叫做central workflow)。 simple - simple和upstream是相似的,只有一点不同,simple必须保证本地分支和它的远程upstream分支同名,否则会拒绝push操作。 matching - push所有本地和远程两端都存在的同名分支。
改变push.default为matching输入命令行 git config --global push.default matching