4 git
我的项目中有一个master分支和一个searchfeature分支.我已将searchfeature分支推送到远程存储库,到目前为止一切正常
当我今天早上在那个分支上工作时,我做了"git push"我得到了以下内容:
warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning: 'nothing' : Do not push anything
warning: 'matching' : Push all matching branches (default)
warning: 'tracking' : Push the current branch to whatever it is tracking
warning: 'current' : Push the current branch
Run Code Online (Sandbox Code Playgroud)
所以我继续做了一个git配置push.default跟踪和瞧,git push工作没问题,没有警告.
我不明白的是,"当前"和"跟踪"之间的区别是,如果你不做"无论跟踪什么",那么"当前"的意义是什么 - 它会去哪里?你使用当前而不是跟踪?
还有什么情况会使用"什么都没有"?
当用户没有告诉"
git push"推送什么时,它总是推送匹配的refs.
对于某些人来说,这是意料之外的,并且push.default引入了新的配置变量以允许更改不同的默认行为.
要公布新功能,如果未配置此功能,则会发出一个大警告,并尝试使用不带参数的git push.
因此,当前和跟踪之间的区别在于:
注意:default nothing对于只读存储库非常有用,只能用于内容咨询,不需要在任何地方完成任何工作.
另请参阅git push current branch SO问题.
2012年3月更新:注意:默认的"匹配"政策可能很快就会改变:
请参阅" 请讨论:什么"git push"应该做什么,当你不说什么推? "
在当前设置(即
push.default=matching)中,git push不带参数将推送本地和远程使用相同名称存在的所有分支.
这通常适用于开发人员推送到自己的公共存储库时,但在使用共享存储库时可能会造成混淆.建议是将默认值更改为'
upstream',即仅推送当前分支,并将其推送到分支git pull将从中拉出.
另一位候选人是'current'; 这会将当前分支仅推送到同名的远程分支.到目前为止所讨论的内容可以在这个帖子中看到:
http://thread.gmane.org/gmane.comp.version-control.git/192547/focus=192694
以前的相关讨论包括:
要加入讨论,请将您的消息发送至:git@vger.kernel.org
| 归档时间: |
|
| 查看次数: |
423 次 |
| 最近记录: |