path: root/builtin/push.c
diff options
authorMatthieu Moy <>2012-06-24 11:01:37 (GMT)
committerJunio C Hamano <>2012-06-25 04:22:57 (GMT)
commitf2c2c90103eaff6f39a289c15b9dbc06efaaf2a8 (patch)
tree722936c4db251743319a12b5b13dde92e0e4cda6 /builtin/push.c
parentf4d80d2639f8ef55c99c3b035c0312969acc7f01 (diff)
push: start warning upcoming default change for push.default
In preparation for flipping the default to the "simple" mode from the "matching" mode that is the historical default, start warning users when they rely on unconfigured "git push" to default to the "matching" mode. Also, advertise for 'simple' where 'current' and 'upstream' are advised. Signed-off-by: Matthieu Moy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/push.c')
1 files changed, 27 insertions, 2 deletions
diff --git a/builtin/push.c b/builtin/push.c
index 08ccb89..9a0a035 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -147,12 +147,37 @@ static void setup_push_upstream(struct remote *remote, int simple)
+static char warn_unspecified_push_default_msg[] =
+N_("push.default is unset; its implicit value is changing in\n"
+ "Git 2.0 from 'matching' to 'simple'. To squelch this message\n"
+ "and maintain the current behavior after the default changes, use:\n"
+ "\n"
+ " git config --global push.default matching\n"
+ "\n"
+ "To squelch this message and adopt the new behavior now, use:\n"
+ "\n"
+ " git config --global push.default simple\n"
+ "\n"
+ "See 'git help config' and search for 'push.default' for further information.\n"
+ "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n"
+ "'current' instead of 'simple' if you sometimes use older versions of Git)");
+static void warn_unspecified_push_default_configuration(void)
+ static int warn_once;
+ if (warn_once++)
+ return;
+ warning("%s\n", _(warn_unspecified_push_default_msg));
static void setup_default_push_refspecs(struct remote *remote)
switch (push_default) {
default_matching_used = 1;
+ warn_unspecified_push_default_configuration();
/* fallthru */
@@ -186,8 +211,8 @@ static const char message_advice_pull_before_push[] =
static const char message_advice_use_upstream[] =
N_("Updates were rejected because a pushed branch tip is behind its remote\n"
"counterpart. If you did not intend to push that branch, you may want to\n"
- "specify branches to push or set the 'push.default' configuration\n"
- "variable to 'current' or 'upstream' to push only the current branch.");
+ "specify branches to push or set the 'push.default' configuration variable\n"
+ "to 'simple', 'current' or 'upstream' to push only the current branch.");
static const char message_advice_checkout_pull_push[] =
N_("Updates were rejected because a pushed branch tip is behind its remote\n"