我刚刚从1.8.4.3升级到1.9.1,我注意到改变了行为。
在1.8.4.3中当我git checkout -b new_branch
和git push -u origin new_branch
时,1.8.4.3将在名为origin
的远程中创建一个新分支。
在1.9中它只是说Branch git_1.9_test_branch set up to track remote branch master from origin by rebasing.
这是为什么?我怎么能有1.9也以类似于1.8的方式在我的名为origin
的遥控器上创建分支?如果我不这样做,当我git push
时,我的更改会被推送到我分支的分支(在这种情况下为master
),这显然是不受欢迎的。
以下示例:
# 1.8.4.3
$ git checkout -b new_branch
Branch git_1.9_test_branch set up to track local branch master_newui by rebasing.
Switched to a new branch 'git_1.9_test_branch'
$ git push origin -u new_branch
Counting objects: 24, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.41 KiB | 0 bytes/s, done.
Total 6 (delta 3), reused 0 (delta 0)
To git@github.com:myorg/myrepo.com.git
* [new branch] new_branch -> new_branch
Branch new_branch set up to track remote branch new_branch from origin by rebasing.
# 1.9.1
$ git co -b new_branch
Branch new_branch set up to track local branch master_newui by rebasing.
Switched to a new branch 'new_branch'
$ git push -u origin new_branch
Branch new_branch set up to track remote branch master_newui from origin by rebasing.
Everything up-to-date
我的全局git配置
[push]
default = upstream
答案 0 :(得分:1)
修复方法是更改我的全局.gitconfig
文件。
我不得不更新这个:
[push]
default = upstream
对此:
[push]
default = simple