您的位置:首页 > 其它

warning: push.default is unset;

2015-08-24 13:39 519 查看
git push warning questions

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
.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: