When I push to remote in Git, I get this warning:
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
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)
To **********************************
6b9a6d2..3ab1eab master -> master
What does this warning mean and what should be done about it?
Update February 2016:
git 2.8 (March 2016) removed that big warning message.
See commit 2f27520 (25 Feb 2016) by Matthieu Moy (
moy
).(Merged by Junio C Hamano --
gitster
-- in commit 15be621, 26 Feb 2016)Original answer (March 2014)
That warning will soon change in git 2.0 (Q2 2014), with commit 289ca27 and commit 11037ee:
See more at "Why is pushing to matching the default in Git?".
This warning was introduced in Git 1.7.11 along with the
simple
style of pushing. The issue is that the current default,matching
, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end result is that they end up rewinding the branch and potentially losing their work or someone else's. Thesimple
mode was introduced as a newpush.default
behavior and will become the default in Git 2.0 (which should hopefully be out sometime early next year).The new
simple
behavior is a lot like theupstream
setting: it only pushes the current branch that you're currently on, if it has a remote branch that it's tracking. It adds one extra criteria: the remote branch must have the same name as the local one.As you discovered, the way to get rid of the message is to set
push.default
. To get the new behavior, use:To get Git's default behavior but without the warning message, use:
I'd really advise against using matching though. In general, most people really want the new
simple
behavior, orupstream
.I encountered the same issue not to a while ago. I solved this by,