git push origin branchname总是推动主人 [英] git push origin branchname always pushes to master
问题描述
在我有权访问的两个框中,当我执行git push --dry-run origin mytestbranch,我得到以下结果:
到git@bitbucket.org:rien / test .git
* [new branch] test - >测试
然而,在我的macbook上,当我尝试相同的命令时,我得到以下结果: / p>
至git@bitbucket.org:rien / test.git
417248a..cf7d564测试 - > master
只有当我明确地说推送到测试原始分支( git push --dry-run origin test:test
)是否按预期工作。
如何更改它以使基本 git push --dry-run bb test
会推送到一个新创建的远程分支而不是master?
我创建了测试分支在 git checkout -b test origin / master
编辑添加:
- 两个分支都有一个 git config push.default
设为跟踪
。
我特别想知道如何配置git,以便当我键入 git push origin test
时,它的作用与 git相同push origin test:test
检查 推送政策 :
git config push.default
我怀疑在第一个盒子里,推送是简单的
git config push.default简单
检查 上游分行 对第二个分行的测试分行:
git config branch.test.merge
在第二个分支上,它可能没有被定义(因此默认值大师)
您可以明确设置:
git checkout test
git分支-u原点/测试
#或
git push -u起源测试:测试
在注意到这些盒子有不同版本的git后,我环顾四周,发现如果我设置
push.default
简单
或匹配
为git版本1.9.3,git push origin test
按预期工作。
看起来像跟踪
push.default
对于这个版本的git已被弃用,所以它不理解它。
I've searched a bit, but can't seem to find the answer.
On two the boxes I have access to, when I do a "git push --dry-run origin mytestbranch", I get the following result:
To git@bitbucket.org:rien/test.git
* [new branch] test -> test
However, on my macbook, when I try the same command, I get the following result:
To git@bitbucket.org:rien/test.git
417248a..cf7d564 test -> master
Only when I explicitly say push to the test origin branch (git push --dry-run origin test:test
) does it work as expected.
How do I change it so that a basic git push --dry-run bb test
will push to a newly created remote branch and not to master?
I created the test branch on both boxes with a git checkout -b test origin/master
Edited to add:
- both branches have a git config push.default
set to tracking
.
I specifically want to know how to configure git so that when i type git push origin test
that it acts the same as git push origin test:test
Check if there is a difference in push policy:
git config push.default
I suspect on the first box, the push is "simple"
git config push.default simple
Check also the upstream branch of the test branch on the second branch:
git config branch.test.merge
On the second branch, it might not be defined (hence the default value master)
git checkout test
git branch -u origin/test
# or
git push -u origin test:test
The OP rien adds in the comments:
After noticing I had a different version of git for those boxes, I looked around some more and found that if I set the
push.default
tosimple
ormatching
for the git version 1.9.3, thegit push origin test
works as expected.
It seems like thetracking
push.default
is deprecated for this version of git so it did not understand it.
这篇关于git push origin branchname总是推动主人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!