Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
124 views
in Technique[技术] by (71.8m points)

What is the result of `git push origin`?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 name
  • nothing : push nothing
  • tracking : will only push the current branch if it is tracking a distant branch
  • current : will push current branch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...