From patchwork Thu Jul 6 04:01:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 13303152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C375C001DD for ; Thu, 6 Jul 2023 04:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232283AbjGFEBo (ORCPT ); Thu, 6 Jul 2023 00:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjGFEBn (ORCPT ); Thu, 6 Jul 2023 00:01:43 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA174199F for ; Wed, 5 Jul 2023 21:01:40 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3a0423ea749so333042b6e.0 for ; Wed, 05 Jul 2023 21:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688616100; x=1691208100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IxjqzbahwAmMYMH8V6k+OfDkJO8FQ403OSYtJGLtV3s=; b=YtoqaA7TPth5MrTOU6DDxCJQlP0MIoYe6pFpHZ4vcYnbdinIRfqoKn+EQAA3lDLtt1 2HMYman54cgz0q5IxgbYLyKAmZv+h6RreerxkwUC90minefwW/LmUI8FUUyMMZSb/BU/ RvIQuSQ6MgMKPJm28IUUeWti231U8mWuqFXd+EigkDKSdL6gzGjophXriG9tkG+9IqX5 XxW5iznRnpyDKiCTjJixGq2HePoxfLGKmqWd1MQp+E63HwLe9f+Lvq4wP2gjSYgIKyV1 dFAlA2bBzYbjK6jHBVSVnAj3j7LoSOJPonwJkfpVG2QB3d+WelvJzT2hSqVC+eRRgFDD vktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688616100; x=1691208100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IxjqzbahwAmMYMH8V6k+OfDkJO8FQ403OSYtJGLtV3s=; b=PuOqhwL6OckeIdCE2bRTO8zpEBxvqLcocIIIi7Zt7CZgBP0r2CD6TswPWFEsESpL4C Ge6VkcPEg3T35lx+8g0ONEIfmfomfktaTmpQs+oUr/DheGzod5Rqok3CkX0VKzsccA6M JTegdBvbwUIde6SwxBiee83bnqY0gOf3PTPfJHghNKicjamlmKaaW/M5cqkqAVxUEjog OpPv3P5lxBY/3lXpoa07izWvx+lszxhU7/TNE9AIu7BS8mUaOT8VH2rV3mx/r+3LUHSA GLKYjHMRxxQ8h7vV+4MJbptMP5Ax7+Od71ceBSfE7HS7oQQtm1sxliqlui9+1EDqI/aN +fIQ== X-Gm-Message-State: ABy/qLYKn93gsnXmdfH9pVQt/eZZSYlELTGlxiUApi7ixsirYUqRc6Qo kAwkd+vr3nsLnbClPN/gOgZhN5qdcAzq/Q== X-Google-Smtp-Source: APBJJlGAq/1kMJwhz9CsxQMXUc2FLeZ6MvqlqUfQzYx1Rw0Aw+Ey6NzXjmppxN/1P27qk1wpO1DFqg== X-Received: by 2002:a05:6808:e8a:b0:3a1:b28f:814c with SMTP id k10-20020a0568080e8a00b003a1b28f814cmr655025oil.1.1688616099880; Wed, 05 Jul 2023 21:01:39 -0700 (PDT) Received: from xavier.lan ([2607:fa18:92fe:92b::2a2]) by smtp.gmail.com with ESMTPSA id j24-20020a63cf18000000b00548d361c137sm303913pgg.61.2023.07.05.21.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 21:01:39 -0700 (PDT) From: Alex Henrie To: git@vger.kernel.org, git@matthieu-moy.fr, christiwald@gmail.com, john@keeping.me.uk, philipoakley@iee.email, gitster@pobox.com, phillip.wood123@gmail.com, phillip.wood@dunelm.org.uk Cc: Alex Henrie Subject: [PATCH v3 1/2] remote: advise about force-pushing as an alternative to reconciliation Date: Wed, 5 Jul 2023 22:01:02 -0600 Message-ID: <20230706040111.81110-2-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706040111.81110-1-alexhenrie24@gmail.com> References: <20230704194756.166111-1-alexhenrie24@gmail.com> <20230706040111.81110-1-alexhenrie24@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Also, don't imply that `git pull` is only for merging. Co-authored-by: Junio C Hamano Signed-off-by: Alex Henrie --- remote.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/remote.c b/remote.c index a81f2e2f17..1fe86f8b23 100644 --- a/remote.c +++ b/remote.c @@ -2323,7 +2323,10 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb, base, ours, theirs); if (advice_enabled(ADVICE_STATUS_HINTS)) strbuf_addstr(sb, - _(" (use \"git pull\" to merge the remote branch into yours)\n")); + _(" (To reconcile your local changes with the work at the remote, you can\n" + " use 'git pull' and then 'git push'. To discard the work at the remote\n" + " and replace it with what you did (alone), you can use\n" + " 'git push --force'.)\n")); } free(base); return 1; From patchwork Thu Jul 6 04:01:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 13303153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D33EC001E0 for ; Thu, 6 Jul 2023 04:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232678AbjGFEBv (ORCPT ); Thu, 6 Jul 2023 00:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjGFEBn (ORCPT ); Thu, 6 Jul 2023 00:01:43 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F412719A0 for ; Wed, 5 Jul 2023 21:01:41 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-666e3b15370so208030b3a.0 for ; Wed, 05 Jul 2023 21:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688616101; x=1691208101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+AeJM2MW61pCLyMZ1lrX8eQ/79HFymObe4v3IQn3/QQ=; b=l1RgNFRUWpmxyfgU1XFNBJtl26/G2TxOMVBU0383CCxI/RULE4fse5bWOOSPqPT8od 97NM6XpN91s18kd30tQo7ZHRNIcpYHvosgPggG3hiWZUZ86HZtWxLzAaEPFlgmMJUuKV DwoKc0yfig0ZfQma6bPb6QOSPiFxS8peCdtrOX18CbikssTo4AtJJYiwDX/jItSxlghD P1x/hyjeT2AUWVrseEjSkdW6ygAsmWdfE7NGldXVXrFRAOMJf4UIdZFsMdH0BKfs7IgJ UncUmhBlP7XKd+uPm0DG+mVKaK+pYM80MgSiJpEpgx50ekxEfap+R8kNr5OrMmnCJT/W ehqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688616101; x=1691208101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+AeJM2MW61pCLyMZ1lrX8eQ/79HFymObe4v3IQn3/QQ=; b=izzStXHwqniV/PreZrGsAypryLXLQ2esIsZ96kd7mOD4aFf04K7+Tcf5JeEHDSaQsZ ty7ozfplnkm1G3AQCYtivDuQBGVvu6BQUhdfok9eDxwLgvRm0vJVUP9lSaywXHPsqP7y v3/hhAvypM3KOdnDvwGeAgtGAL3aKWRYZNvXTylKLVonfD8FO/n4GcBY+V+V3CjuTtSk 0DYXACK6sXQgaod/jpbkhtkfia8W0+hoRYGAmbkqZ7zBwFcbjhqkGgsfX2EKSIqQaA0I fxkjfSky4wXoKuv9aomSnDrbLN/IPmjrRfd7CAtaiOw9+PT9/Tcf9Kxx5XH/IGGy43nT Zazg== X-Gm-Message-State: ABy/qLY89/ipUh3nbdEwvX5D5nOUerL1E5AsrMeGNVXcj2WxhTdxi+o4 lIp8kpBqom/GOxMq2DsJm/nRug0aWvMbCw== X-Google-Smtp-Source: APBJJlE55pOio5n2QQTB/3uTco5h1mHg1gy7PvDpsC2F5aQbK2c+TGLDGRZ3/t2QpjE0DYATlKF1wQ== X-Received: by 2002:a05:6a20:94:b0:12d:d615:9279 with SMTP id 20-20020a056a20009400b0012dd6159279mr535084pzg.25.1688616100929; Wed, 05 Jul 2023 21:01:40 -0700 (PDT) Received: from xavier.lan ([2607:fa18:92fe:92b::2a2]) by smtp.gmail.com with ESMTPSA id j24-20020a63cf18000000b00548d361c137sm303913pgg.61.2023.07.05.21.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 21:01:40 -0700 (PDT) From: Alex Henrie To: git@vger.kernel.org, git@matthieu-moy.fr, christiwald@gmail.com, john@keeping.me.uk, philipoakley@iee.email, gitster@pobox.com, phillip.wood123@gmail.com, phillip.wood@dunelm.org.uk Cc: Alex Henrie Subject: [PATCH v3 2/2] push: advise about force-pushing as an alternative to reconciliation Date: Wed, 5 Jul 2023 22:01:03 -0600 Message-ID: <20230706040111.81110-3-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706040111.81110-1-alexhenrie24@gmail.com> References: <20230704194756.166111-1-alexhenrie24@gmail.com> <20230706040111.81110-1-alexhenrie24@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Also, don't put `git pull` in an awkward parenthetical, because `git pull` can always be used to reconcile branches and is the normal way to do so. Signed-off-by: Alex Henrie --- builtin/push.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index 6f8a8dc711..b2f0a64e7c 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -301,21 +301,24 @@ static void setup_default_push_refspecs(int *flags, struct remote *remote) static const char message_advice_pull_before_push[] = N_("Updates were rejected because the tip of your current branch is behind\n" - "its remote counterpart. Integrate the remote changes (e.g.\n" - "'git pull ...') before pushing again.\n" + "its remote counterpart. Use 'git pull' to integrate the remote changes\n" + "before pushing again, or use 'git push --force' to delete the remote\n" + "changes and replace them with your own.\n" "See the 'Note about fast-forwards' in 'git push --help' for details."); static const char message_advice_checkout_pull_push[] = N_("Updates were rejected because a pushed branch tip is behind its remote\n" - "counterpart. Check out this branch and integrate the remote changes\n" - "(e.g. 'git pull ...') before pushing again.\n" + "counterpart. Check out this branch and use 'git pull' to integrate the\n" + "remote changes before pushing again, or use 'git push --force' to delete\n" + "the remote changes and replace them with your own.\n" "See the 'Note about fast-forwards' in 'git push --help' for details."); static const char message_advice_ref_fetch_first[] = - N_("Updates were rejected because the remote contains work that you do\n" - "not have locally. This is usually caused by another repository pushing\n" - "to the same ref. You may want to first integrate the remote changes\n" - "(e.g., 'git pull ...') before pushing again.\n" + N_("Updates were rejected because the remote contains work that you do not\n" + "have locally. This is usually caused by another repository pushing to\n" + "the same ref. Use 'git pull' to integrate the remote changes before\n" + "pushing again, or use 'git push --force' to delete the remote changes\n" + "and replace them with your own.\n" "See the 'Note about fast-forwards' in 'git push --help' for details."); static const char message_advice_ref_already_exists[] = @@ -327,10 +330,10 @@ static const char message_advice_ref_needs_force[] = "without using the '--force' option.\n"); static const char message_advice_ref_needs_update[] = - N_("Updates were rejected because the tip of the remote-tracking\n" - "branch has been updated since the last checkout. You may want\n" - "to integrate those changes locally (e.g., 'git pull ...')\n" - "before forcing an update.\n"); + N_("Updates were rejected because the tip of the remote-tracking branch has\n" + "been updated since the last checkout. Use 'git pull' to integrate the\n" + "remote changes before pushing again, or use 'git push --force' to delete\n" + "the remote changes and replace them with your own.\n"); static void advise_pull_before_push(void) {