警告:push.default 未设置;它的隐含值在 Git 2.0 中发生了变化 [英] Warning: push.default is unset; its implicit value is changing in Git 2.0

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

问题描述

我已经使用 Git 一段时间了,最​​近下载了一个更新,却发现当我尝试 push 时出现此警告消息.

I've been using Git for a while now and have recently downloaded an update only to find this warning message come up when I try to push.

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

我显然可以将其设置为提到的值之一,但它们是什么意思?simplematching 有什么区别?

I can obviously set it to one of the values mentioned, but what do they mean? What's the difference between simple and matching?

如果我在一个客户端上更改它,我是否需要对与我共享 repos 的其他客户端执行任何操作?

If I change it on one client will I need to do anything on other clients that I share repos with?

推荐答案

文档,但我会尝试总结一下:

It's explained in great detail in the docs, but I'll try to summarize:

  • matching 意味着 git push推送所有本地分支到远程的同名分支.这很容易意外地推送您不打算推送的分支.

  • matching means git push will push all your local branches to the ones with the same name on the remote. This makes it easy to accidentally push a branch you didn't intend to.

simple 意味着 git push仅将当前分支推送到 git pull 将从中拉取的分支,并检查他们的名字是否匹配.这是一种更直观的行为,这就是为什么将默认值更改为此的原因.

simple means git push will push only the current branch to the one that git pull would pull from, and also checks that their names match. This is a more intuitive behavior, which is why the default is getting changed to this.

此设置仅影响本地客户端的行为,并且可以通过在命令行上显式指定要推送的分支来覆盖.其他客户端可以有不同的设置,它只会影响当你没有指定要推送的分支时会发生什么.

This setting only affects the behavior of your local client, and can be overridden by explicitly specifying which branches you want to push on the command line. Other clients can have different settings, it only affects what happens when you don't specify which branches you want to push.

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

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