Warning: push.default is unset; its implicit value is changing in Git 2.0

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 .


    I realize this is an old post but as I just ran into the same issue and had trouble finding the answer I thought I'd add a bit.

    So @hammar's answer is correct. Using push.default simple is, in a way, like configuring tracking on your branches so you don't need to specify remotes and branches when pushing and pulling. The matching option will push all branches to their corresponding counterparts on the default remote (which is the first one that was set up unless you've configured your repo otherwise).

    One thing I hope others find useful in the future is that I was running Git 1.8 on OS X Mountain Lion and never saw this error. Upgrading to Mavericks is what suddenly made it show up (running git --version will show git version 1.8.3.4 (Apple Git-47) which I'd never seen until the update to the OS.


    If you get a message from git complaining about the value simple in the configuration, check your git version .

    After upgrading XCode (on a Mac running Mountain Lion ), which also upgraded git from 1.7.4.4 to 1.8.3.4 , shells started before the upgrade were still running git 1.7.4.4 and complained about the value simple for push.default in the global config.

    The solution was to close the shells running the old version of git and use the new version!

    链接地址: http://www.djcxy.com/p/26812.html

    上一篇: 你如何推动一个Git分支(而不是其他分支)?

    下一篇: 警告:push.default未设置; 其隐含价值在Git 2.0中正在发生变化