`git push origin`的结果是什么? [英] What is the result of `git push origin`?

查看:226
本文介绍了`git push origin`的结果是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的地方特色分部foo工作过。然后,我想推动这个新的分支来源,以便其他人可以在它上面工作。正常的做法是:
$ b $ pre $ git push origin foo:foo

我最终做到了,并且完全按预期工作,推出了61个对象。在做这件事之前,我一直在尝试:

  git push origin 

想想也许它会默认根据我的本地分支的名称创建一个新的远程分支。输出是正常的输出,只有13个物体被推高。结果是不可思议的。



那么当我做<$ c时,git认为我告诉它该做什么$ c> git push origin ,以及它对我的远程回购有什么影响?

解决方案

这取决于你的git版本。在旧版本中,它会尝试推送也存在于远端的每个本地分支。从版本1.6.3开始,行为由 push.default 配置选项控制。



值为:




  • 匹配:[默认值] push all branch使用相同的本地和远程名称

  • nothing :无需推送

  • 跟踪:只会跟踪当前分支,如果它正在跟踪远处的分支

  • 当前:将推送当前分行


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

这篇关于`git push origin`的结果是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆