Git警告:push.default未设置;其隐含价值正在发生变化 [英] Git warning: push.default is unset; its implicit value is changing

查看:128
本文介绍了Git警告:push.default未设置;其隐含价值正在发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 警告:push.default未设置;它的隐含价值在
Git 2.0中从匹配变为简单。要压制此消息
并在默认更改后维护当前行为,请使用:

git config --global push.default匹配

若要压制此消息并现在采用新的行为,使用:

git config --global push.default简单

请参阅'git help config'并搜索'push.default'以获取更多信息。
(简单模式在Git 1.7.11中引入)如果您有时使用旧版本的Git,请使用类似模式
'current'而不是'simple'

至**********************************
6b9a6d2..3ab1eab master - > master

这个警告是什么意思,应该怎么处理?

解决方案

这个警告是在Git 1.7.11中引入的,以及简单的推送风格。问题是当前的默认值匹配可能导致没有经验的用户在某些分支位于远程等价物后强制推送,因为分支不是最新的。最终的结果是,他们最终倒闭分支,并有可能失去他们的工作或其他人的工作。 简单模式作为新的 push.default 行为引入,并将成为Git 2.0中的默认模式明年年初)。

新的简单的行为很像 upstream 设置:它只会推送当前所在的当前分支,如果它有一个正在跟踪的远程分支。它增加了一个额外的标准:远程分支必须具有与本地名称相同的名称。



正如您发现的那样,摆脱消息的方式是将 push.default 。要获得新的行为,请使用:

  git config --global push.default简单

要获得Git的默认行为,但没有警告消息,请使用:

  git config --global push.default matching 

我真的会建议使用匹配。一般来说,大多数人真的想要新的简单的行为,或上游


When I push to remote in Git, I get this warning:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

To **********************************
   6b9a6d2..3ab1eab  master -> master

What does this warning mean and what should be done about it?

解决方案

This warning was introduced in Git 1.7.11 along with the simple style of pushing. The issue is that the current default, matching, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end result is that they end up rewinding the branch and potentially losing their work or someone else's. The simple mode was introduced as a new push.default behavior and will become the default in Git 2.0 (which should hopefully be out sometime early next year).

The new simple behavior is a lot like the upstream setting: it only pushes the current branch that you're currently on, if it has a remote branch that it's tracking. It adds one extra criteria: the remote branch must have the same name as the local one.

As you discovered, the way to get rid of the message is to set push.default. To get the new behavior, use:

git config --global push.default simple

To get Git's default behavior but without the warning message, use:

git config --global push.default matching

I'd really advise against using matching though. In general, most people really want the new simple behavior, or upstream.

这篇关于Git警告:push.default未设置;其隐含价值正在发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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