Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
537 views
in Technique[技术] by (71.8m points)

git - 警告:push.default未设置;它的隐含值在Git 2.0中发生了变化(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 .

(我一直在使用Git一段时间,并且最近只下载了一个更新,以便在我尝试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 ?

(simplematching之间有什么区别?)

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

(如果我在一个客户端上更改它,我是否需要在我共享回购的其他客户端上做任何事情?)

  ask by Marko translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

    (matching意味着git push会将所有本地分支推送到远程上具有相同名称的分支 。)

    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.

    (simple意思是git push只将当前分支推送到git pull将从中拉出的分支 ,并检查它们的名称是否匹配。)

    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 .

(其他客户端可以具有不同的设置, 它只会影响您未指定要推送哪些分支时发生的情况 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...