创建一个与远程分支同名的本地分支时,推送和拉取的配置将会不同。
当前远程分支如下:
为什么第二个分支没有推送配置就被创建了?
当前远程分支如下:
$ git branch -r
origin/HEAD -> origin/master
origin/master
origin/someBranch
创建跟踪远程分支的本地分支:
$ git branch someBranch origin/someBranch
Branch someBranch set up to track remote branch someBranch from origin.
$ git branch someOtherBranch origin/someBranch
Branch someOtherBranch set up to track remote branch someBranch from origin.
检查跟踪和上游信息:
$ git remote show origin
* remote origin
Fetch URL: git@github.somewhere.com:maic/repo.git
Push URL: git@github.somewhere.com:maic/repo.git
HEAD branch: master
Remote branches:
master tracked
someBranch tracked
Local branches configured for 'git pull':
master merges with remote master
someBranch merges with remote someBranch
someOtherBranch merges with remote someBranch
Local refs configured for 'git push':
master pushes to master (up to date)
someBranch pushes to someBranch (up to date)
为什么第二个分支没有推送配置就被创建了?