Reputation: 43
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 [email protected]:rien/test.git
* [new branch] test -> test
However, on my macbook, when I try the same command, I get the following result:
To [email protected]: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
Upvotes: 4
Views: 1212
Reputation: 1323203
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.
Upvotes: 6