git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: qgit idea: interface for cherry-picking

From
Junio C Hamano <junkio@cox.net>
Date
Jul 3, 2006, 06:42 UTC
Message-ID
<7vzmfrrxyp.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<e5bfff550607022245s2ef160fu5ad30a822f06117d@mail.gmail.com>
"Marco Costalba" <mcostalba@gmail.com> writes:
> When I need to modify the patch/revision before to import I usaually
> drag&drop and then I call git-reset --soft, then I edit working
> directory and commit again.

These days, I tend to just let "am" or "pull" do its thing, edit working tree and retest, and run "commit --amend". Before we added "commit --amend", I used to do soft reset and recommit like you described above. One advantage of "commit --amend" is that it can even amend a merge, but I do not think it applies to what Jakub wants in this thread.

Show 5 quoted lines
> Perhaps I can automate this in case the user answers "No, apply to
> working dir only" to the message box.
>
> Is it the correct way to go or is better to wait for a --no-commit
> flag in git-am?

Probably your "git-am --no-commit" would stop after applying one patch (the first one in the sequence) but before writing a commit. We already sometimes do that when the patch does not apply cleanly, so I do not offhand have much objection against adding such a flag.

I think the workflow to continue after "git-am --no-commit" will be quite similar to what you would do when "git-am --3way" stops with conflicts. In order to continue from there, you would do whatever is needed to bring the index into the shape you wanted to have if the patch applied cleanly. Then "git am --resolved".

Perhaps something like the attached. If somebody finds it useful, after testing it out, please kick it back to me, perhaps with a paragraph or two to properly document it.

-- >8 -- git-am --fail

The new flag prevents a new commit from being made even when the patch applies cleanly. This gives you an opportunity to further fix up the change in your working tree before making the final commit.

In order to continue, do whatever is needed to bring the index into the shape you wanted to have if the patch applied cleanly, and run "git am --resolved".

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-am.sh b/git-am.sh
index 679045a..77d8cd9 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -3,7 +3,7 @@ #
 # Copyright (c) 2005, 2006 Junio C Hamano
 
 USAGE='[--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way]
-  [--interactive] [--whitespace=<option>] <mbox>...
+  [--fail] [--interactive] [--whitespace=<option>] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
 
@@ -91,7 +91,7 @@ fall_back_3way () {
 }
 
 prec=4
-dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg=
+dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg= fail=
 
 while case "$#" in 0) break;; esac
 do
@@ -109,6 +109,9 @@ do
 	-b|--b|--bi|--bin|--bina|--binar|--binary)
 	binary=t; shift ;;
 
+	-f|--f|--fa|--fai|--fail)
+	fail=t; shift ;;
+
 	-3|--3|--3w|--3wa|--3way)
 	threeway=t; shift ;;
 	-s|--s|--si|--sig|--sign|--signo|--signof|--signoff)
@@ -401,6 +404,10 @@ do
 	then
 		echo Patch failed at $msgnum.
 		stop_here_user_resolve $this
+	elif test -n "$fail"
+	then
+		echo Stopped at $msg per user request
+		stop_here_user_resolve $this
 	fi
 
 	if test -x "$GIT_DIR"/hooks/pre-applypatch
Previous: Marco CostalbaNext: Marco Costalba
Message 7 of 18 in “qgit idea: interface for cherry-picking”
  1. Jakub NarebskiJul 2, 2006
  2. Marco CostalbaJul 2, 2006
  3. Jakub NarebskiJul 2, 2006
  4. Marco CostalbaJul 2, 2006
  5. Jakub NarebskiJul 2, 2006
  6. Marco CostalbaJul 3, 2006
  7. Junio C HamanoJul 3, 2006
  8. Marco CostalbaJul 3, 2006
  9. Junio C HamanoJul 3, 2006
  10. Marco CostalbaJul 4, 2006
  11. Jakub NarebskiJul 4, 2006
  12. Marco CostalbaJul 4, 2006
  13. Jakub NarebskiJul 4, 2006
  14. Marco CostalbaJul 4, 2006
  15. Junio C HamanoJul 4, 2006
  16. Jakub NarebskiJul 4, 2006
  17. Marco CostalbaJul 4, 2006
  18. Marco CostalbaJul 4, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.