- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我的项目中有一个 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
所以我继续执行 git config push.default 跟踪,瞧,git push 可以正常工作,没有任何警告。
我不明白的是“当前”和“跟踪”之间的区别是什么,如果您不对“正在跟踪的任何东西”执行操作,那么“当前”的意义何在 - 它会去哪里?,您会在哪些情况下使用电流而不是跟踪?
还有,什么场景会用到“nothing”?
最佳答案
自 Git1.6.3 :
When the user does not tell "
git push
" what to push, it has always pushed matching refs.
For some people it is unexpected, and a new configuration variablepush.default
has been introduced to allow changing a different default behavior.
To advertise the new feature, a big warning is issued if this is not configured and a git push without arguments is attempted.
所以current和tracking的区别在于:
注意:default nothing
对于只读存储库很有用,仅用于内容咨询,不应在任何地方完成和发布任何工作。
另见 git push current branch所以问题。
2012 年 3 月更新:注意:默认的“匹配”政策可能很快就会改变:
参见“Please discuss: what "git push" should do when you do not say what to push?”
In the current setting (i.e.
push.default=matching
),git push
without argument will push all branches that exist locally and remotely with the same name.
This is usually appropriate when a developer pushes to his own public repository, but may be confusing if not dangerous when using a shared repository.The proposal is to change the default to '
upstream
', i.e. push only the current branch, and push it to the branch git pull would pull from.
Another candidate is 'current
'; this pushes only the current branch to the remote branch of the same name.What has been discussed so far can be seen in this thread:
http://thread.gmane.org/gmane.comp.version-control.git/192547/focus=192694
Previous relevant discussions include:
To join the discussion, send your messages to: git@vger.kernel.org
关于Git 推送问题 - 迂腐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2294870/
我的项目中有一个 master 分支和一个 searchfeature 分支。我已将 searchfeature 分支推送到远程存储库,目前一切正常 今天早上我在那个分支上工作时,我做了“git pu
当我使用“__FUNCTION__”预定义宏(在 gcc 和 clang 中)输入函数时,我正在打印(printf)函数的名称。但是,如果我使用 -Wpedantic,我会收到此警告: warning
我是一名优秀的程序员,十分优秀!