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

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

问题描述

我现在一直在使用Git,并且最近下载了一个更新,当我试图 push 时发现这条警告消息。

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

git config --global push.default匹配

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

git config --global push.default simple

我明显可以将其设置为所提到的值之一,但它们的含义是什么? 简单匹配



有什么区别我在一个客户端改变了它,我需要在其他客户端上做任何与我共享回购站的任何事情吗? 解决方案

详细信息请参阅文档,但我会尽力总结:


  • 匹配意味着 git push 将所有本地分行推送至远程同名的分行。这可以很容易地意外推送你不想要的分支。

  • strong>只将当前分支推送到 git pull 将从拉出来的分支,并检查它们的名称是否匹配。这是一个更直观的行为,这就是为什么默认值被更改为此值。

    $ b

    此设置仅影响您的本地客户端的行为,并且可以通过明确指定要在命令行上推送哪些分支来重写。其他客户端可以具有不同的设置,它仅影响未指定要推送哪个分支时发生的情况


    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
    

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

    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 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 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天全站免登陆