I worked on my local feature branch, foo. Then I wanted to push that new branch to origin so others could work on it. The normal way to do this is:
git push origin foo:foo
Which I eventually did, and it worked completely as expected, pushing up 61 objects. Before doing that, on a whim, I tried:
git push origin
Thinking maybe it would default to making a new remote branch based on the name of my local branch. The output was normal push output, with only 13 objects pushed up. The results were imperceivable. Nothing new showed up for the other devs or in my local repo after a fetch.
So what does git think I'm telling it to do when I do git push origin
, and what effect, if any, did it have on my remote repo?
It depends on your git version. In old version, it would try to push each and every local branche that is also present on the distant side. Since version 1.6.3, the behaviour is controlled by the push.default
configuration option.
Values are:
matching
: [the default] push all branch with same local and distant namenothing
: push nothingtracking
: will only push the current branch if it is tracking a distant branchcurrent
: will push current branchIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With