情景:
a.本地庫新建的分支,而Git服務器沒有這個分支
服務器分支
??master
本地新建分支:rdar-MS,并git checkout? rdar-MS上
??masterrdar-testrdar-MS
更改rdar-MS分支上的文件,
git add .
git commit -m " "
后,
git push origin? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #origin = http://**.**.*.**/***/test.git
在GitLab服務器上,自動添加了rdar-MS分支
??masterrdar-MS
使用以下指令等同于?git push origin 指令的效果
第一種:git?push??rdar-MS
第二種:git?push?--set-upstream?origin?rdar-MS
總結:
在本地庫新開的分支,如果服務器上沒有,在本地中在新分支編輯,push后,服務器會自動添加新分支;若push的時候不是在本地庫的新分支上操作,服務器不會添加新分支。即在新分支上push,服務器會自動添加新分支,否則服務器不會添加新分支。
轉載于:https://blog.51cto.com/13502993/2162374