在升级了高版本的Git工具后,在使用git push操作时,可能会出现如下提示:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
作为一个英语小白,看到这一大串英文,内心其实是拒绝的,看都不想看。但作为一个开发者,还是看吧:
警告:push.default没有设置,它的隐含值在Git2.0的时候已经从‘matching’变成了‘simple’。去掉该提示消息并且保持旧版本的git push行为,
使用:
git config --global push.default matching
去掉该提示消息并采用新版本的git push行为,使用:
git config --global push.default simple
当push.default设置为‘matching’时,git将会把本地分支代码push到远程同名分支上去。
从Git 2.0开始,push.default变成了更为保守的‘simple’行为模式,它只将当前分支推送到对应的“git pull”用于更新当前分支的远程分支。
通过‘git help config’并搜索‘push.default’获取更多信息。(‘simple’模式在Git1.7.11中已作介绍。如果你有时候使用旧版本的Git,
可以使用‘current’模式来代替‘simple’模式。)
看了上面的中文是不是很清晰了呢?不管你是使用‘matching’模式还是‘simple’模式,都能去掉那一大串提示消息,但是具体使用哪个模式需要读者自行判断,对笔者而言,两个模式都可以,最后选择了‘simple’模式。学习的道路上总有不期而遇的惊喜与惊恐,沉着冷静对待,你将愈战愈强。