Git development
 help / color / mirror / Atom feed
From: Ralf Habacker <ralf.habacker@freenet.de>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@ozlabs.org>, Johannes Sixt <j6t@kdbg.org>,
	Taylor Blau <me@ttaylorr.com>
Subject: gitk: add cherry-pick with cross-reference action
Date: Mon, 26 Oct 2026 19:42:27 +0100	[thread overview]
Message-ID: <57d4f046-26fc-4dd3-8a90-4132c5941ca4@freenet.de> (raw)

 From ae2217025407ff91f3ea3332f94d5b0bdcd01e70 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Tue, 26 May 2026 22:55:47 +0200
Subject: [PATCH] gitk: add cherry-pick with cross-reference action
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a context-menu action to cherry-pick a commit with a reference to
the original commit in the commit message.

This commit closes a gap in gitk’s GUI workflow for projects that
for example require backported commits to remain traceable to their
originals.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
---
  gitk-git/gitk | 11 ++++++-----
  1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 9506739c50..0c7db0a4d9 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2859,6 +2859,7 @@ proc makewindow {} {
          {mc "Write commit to file" command writecommit}
          {mc "Create new branch" command mkbranch}
          {mc "Cherry-pick this commit" command cherrypick}
+        {mc "Cherry-pick with cross-reference" command {cherrypick -x}}
          {mc "Reset HEAD branch to here" command resethead}
          {mc "Mark this commit" command markhere}
          {mc "Return to mark" command gotomark}
@@ -9167,13 +9168,13 @@ proc rowmenu {x y id} {
      if {$id ne $nullid && $id ne $nullid2} {
          set menu $rowctxmenu
          if {$mainhead ne {}} {
-            $menu entryconfigure 8 -label [mc "Reset %s branch to here" 
$mainhead] -state normal
+            $menu entryconfigure 9 -label [mc "Reset %s branch to here" 
$mainhead] -state normal
          } else {
-            $menu entryconfigure 8 -label [mc "Detached head: can't 
reset" $mainhead] -state disabled
+            $menu entryconfigure 9 -label [mc "Detached head: can't 
reset" $mainhead] -state disabled
          }
-        $menu entryconfigure 10 -state $mstate
          $menu entryconfigure 11 -state $mstate
          $menu entryconfigure 12 -state $mstate
+        $menu entryconfigure 13 -state $mstate
      } else {
          set menu $fakerowmenu
      }
@@ -9881,7 +9882,7 @@ proc exec_citool {tool_args {baseid {}}} {
      array set env $save_env
  }

-proc cherrypick {} {
+proc cherrypick {{option "-r"}} {
      global rowmenuid curview
      global mainhead mainheadid
      global gitdir
@@ -9898,7 +9899,7 @@ proc cherrypick {} {
      update
      # Unfortunately git-cherry-pick writes stuff to stderr even when
      # no error occurs, and exec takes that as an indication of error...
-    if {[catch {safe_exec [list sh -c "git cherry-pick -r $rowmenuid 
2>&1"]} err]} {
+    if {[catch {safe_exec [list sh -c "git cherry-pick $option 
$rowmenuid 2>&1"]} err]} {
          notbusy cherrypick
          if {[regexp -line \
                   {Entry '(.*)' (would be overwritten by merge|not 
uptodate)} \
-- 
2.54.0


             reply	other threads:[~2026-10-26 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 18:42 Ralf Habacker [this message]
2026-10-27  9:55 ` gitk: add cherry-pick with cross-reference action Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57d4f046-26fc-4dd3-8a90-4132c5941ca4@freenet.de \
    --to=ralf.habacker@freenet.de \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=me@ttaylorr.com \
    --cc=paulus@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox