From patchwork Sun Jul 2 20:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 13299488 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 F3A74EB64D9 for ; Sun, 2 Jul 2023 20:10:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232695AbjGBUKo (ORCPT ); Sun, 2 Jul 2023 16:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbjGBUKb (ORCPT ); Sun, 2 Jul 2023 16:10:31 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22281BCC for ; Sun, 2 Jul 2023 13:09:16 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6686708c986so3179415b3a.0 for ; Sun, 02 Jul 2023 13:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688328547; x=1690920547; 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=LH+0M82oXpk3+tPNq9YIb5JydDFq4Isoi54/18fUW8c=; b=if0NTZ42Rl3rn9bSm1TDKJ5b61eGWVx15/85DZ176uIgDoGRaJTW/oN4Z97+khRa8u rwczmQvBZ3bs4HNW6fWQoLsVvO8j3ie7SFiKumrdKS7/XLImriwBr8UqMh8sWAMdCDAM VDRDc+q4wG9Zgc4kl4isXJarkFgpXbARpj0tyaSf6vo6lzwE9i2Bm8DGe5Ws9F8whYXz /X7oeb+MKWY1vxXBMLbsq51K9brWu7JYUCQeBvmfLwVdEiVGsKiCcrEfJTP469BLcWAc yJbODMDE8hlHd/w3lKQ+0p+GS7CxFwdVO7ZFyZMJHmaJJUT4ULisyKbBX10ime2lhhF3 Nc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688328547; x=1690920547; 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=LH+0M82oXpk3+tPNq9YIb5JydDFq4Isoi54/18fUW8c=; b=RLwU10lOhpoK/Bh1aIW6H4J+fLjMrvVFoeuT9E4J3Tq4g/hi+fimmI8sk6J8CVDfZb a9zVLux+zgflvF60MwGWCVL8lEtAK/egvx44le0ziZ0URS0ktrf4WazeAFnBGHRx1wU1 J2ZmCZjRv9ePcxDdwZLRWdMN/XR+SO8if8gkWmdGbSk/g7n0D6ufGFwn9a1QUjW+Q5XQ t43RmuIhqTkAlcx1XMcfBVCjHZYKsIgblqLofQ55mkKRx2tpWWf17uUDddc/hwNOuOLf PgeFoyve37aJou7XVDqW6Wd14qke1G7udafGCKwYTarVfNY/kai6WRQ5WSTiiE2WkDLc xtjg== X-Gm-Message-State: ABy/qLbb4hJlOXjMtDMfXWe59WgNxqEloJi4MBjBLQZhUvEq03MigB19 GGPvIQcNXZwKXJheH13KfdpdPBy8t9Y= X-Google-Smtp-Source: APBJJlHMFu9I/2VT6WFWJfa5rlDEt1OdRRCEgkgI5cbcL0qAbBm0Ulati6UhVOY7gT1Qt4OVu2pPWg== X-Received: by 2002:a05:6a00:c85:b0:64d:46b2:9a58 with SMTP id a5-20020a056a000c8500b0064d46b29a58mr12913986pfv.26.1688328547247; Sun, 02 Jul 2023 13:09:07 -0700 (PDT) Received: from xavier.lan ([2607:fa18:92fe:92b::2a2]) by smtp.gmail.com with ESMTPSA id c14-20020aa78c0e000000b0067b24701daasm9342937pfd.86.2023.07.02.13.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 13:09:06 -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 Cc: Alex Henrie Subject: [PATCH 1/2] remote: advise about force-pushing as an alternative to reconciliation Date: Sun, 2 Jul 2023 14:08:16 -0600 Message-ID: <20230702200818.1038494-2-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230702200818.1038494-1-alexhenrie24@gmail.com> References: <20230702200818.1038494-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. Signed-off-by: Alex Henrie --- remote.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/remote.c b/remote.c index a81f2e2f17..161d0cfe96 100644 --- a/remote.c +++ b/remote.c @@ -2323,7 +2323,8 @@ 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")); + _(" (use \"git pull\" to reconcile your local branch with the remote branch,\n" + " or \"git push --force\" to overwrite the remote branch with your local branch)\n")); } free(base); return 1; From patchwork Sun Jul 2 20:08:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 13299487 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 91358EB64DD for ; Sun, 2 Jul 2023 20:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbjGBUKm (ORCPT ); Sun, 2 Jul 2023 16:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233207AbjGBUKa (ORCPT ); Sun, 2 Jul 2023 16:10:30 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E411BCD for ; Sun, 2 Jul 2023 13:09:16 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-55ba5bb0bf3so136734a12.1 for ; Sun, 02 Jul 2023 13:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688328548; x=1690920548; 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=g0wikYPxhqmtd1gjY4qi1CRmOqoMplLxkpvwS1Ihiy0=; b=Yx8v3WWCeSCcO+U6ub/JzyuUitZX9lPiOpjfcya/9i7GlVurk6l+AI5BtsRNOX8lxm UzIpj+p1W+cJN1Ey3OceDS7DOcjPRT+5CXtQJDVCrDOJAB7mFEmjY82aHGrx4RacBx7E P9JLv91JmFOR6+ygI6r1YkgeGR5wWIeZmm7gvoprcwwcJivBKfQUN6yJWzex/nNfgZu/ yuE0BIT5t3Ua4rN4aOOtKXJm+ULdIBrBd56qMDjKL8tgaPbZl4z2NXUPtXo7Tx6p8gG/ yHMDKwvSF4IvNpNcU6UGCd7F6eQg44s4Fs8Z0Yu10tRYaIWjidI1JXPO1vl/O4CwTOgG Kdmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688328548; x=1690920548; 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=g0wikYPxhqmtd1gjY4qi1CRmOqoMplLxkpvwS1Ihiy0=; b=TnDsLrOn+Gr+i/RmHs4rGbKhzrh1ow43fOxlqU6dwuODvCJuGZDkm5vEbyOypdmj9I HE8qqjaX1/sf/bwQ5n2ymoe9KPWBl0+aHbsxED1EV4RY54YF15fHzkh9voznhPc3UatO K1TXVYOCJ7B7Vd3iWiYtzHuYFwXsuBBA0xsy5ft14ObIRGaBoc97AKZUXFGxwV6hGZQ1 io3GFbFgl2g4j57FwrVJXRRRupzmmPa+0TDCePahSShEyQHcptzz+D2cqqqDGSZGkui7 Qbvwct+jdV3DYeMIaDumzOAfm/27ohCNUMG/XMDaS0XIhsm8fCtj+MVpO0qX7ZZUR7Gr aBXg== X-Gm-Message-State: AC+VfDxvARkRHEdTKS/tUoc2SckQLlyeG5zZYKck0maoYd9HPyJi62kK PVL+HBHY5r9ItqmMHF2LcDuuAccbXQc= X-Google-Smtp-Source: ACHHUZ5on+aFmPeS2k98UsIbAUFL5T5t7xbzf6xixblk+/owm6swqdQEtt4MXtWt8RLW9gAu59RhQQ== X-Received: by 2002:a05:6a20:3ca5:b0:10b:bf2d:71bb with SMTP id b37-20020a056a203ca500b0010bbf2d71bbmr13675453pzj.27.1688328548344; Sun, 02 Jul 2023 13:09:08 -0700 (PDT) Received: from xavier.lan ([2607:fa18:92fe:92b::2a2]) by smtp.gmail.com with ESMTPSA id c14-20020aa78c0e000000b0067b24701daasm9342937pfd.86.2023.07.02.13.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 13:09:07 -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 Cc: Alex Henrie Subject: [PATCH 2/2] push: advise about force-pushing as an alternative to reconciliation Date: Sun, 2 Jul 2023 14:08:17 -0600 Message-ID: <20230702200818.1038494-3-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230702200818.1038494-1-alexhenrie24@gmail.com> References: <20230702200818.1038494-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 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/builtin/push.c b/builtin/push.c index 6f8a8dc711..9441c71bb0 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\n" + "delete 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" + "to 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[] = @@ -328,9 +331,10 @@ static const char message_advice_ref_needs_force[] = 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"); + "branch has been updated since the last checkout. Use 'git pull' to\n" + "integrate the remote changes before pushing again, or use\n" + "'git push --force' to delete the remote changes and replace them\n" + "with your own.\n"); static void advise_pull_before_push(void) {