threads / patch / 1672

patchUse "git cherry-pick" in "git rebase"

Subject: [PATCH] Use "git cherry-pick" in "git rebase"

## tl;dr

One message between Aug 27, 2005 and Aug 27, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Junio C Hamano· Aug 27, 2005, 01:19 UTC · lore
Rewrite "git rebase" using "git cherry-pick".
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 git-rebase-script |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
913404ae6371857c21c696cc3d8b0a04421fdeb2
Show changes to git-rebase-script +10 −6
diff --git a/git-rebase-script b/git-rebase-script
--- a/git-rebase-script
+++ b/git-rebase-script
@@ -37,7 +37,7 @@ git-rev-parse --verify "$upstream^0" >"$
 
 tmp=.rebase-tmp$$
 fail=$tmp-fail
-trap "rm -rf $tmp-*" 0 1 2 3 15
+trap "rm -rf $tmp-*" 1 2 3 15
 
 >$fail
 
@@ -48,14 +48,18 @@ do
 	-) continue ;;
 	esac
 	S=`cat "$GIT_DIR/HEAD"` &&
-        GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p $commit &&
-	git-commit-script -C "$commit" || {
+	git-cherry-pick-script --replay $commit || {
+		echo >&2 "* Not applying the patch and continuing."
 		echo $commit >>$fail
-		git-read-tree --reset -u $S
+		git-reset-script --hard $S
 	}
 done
 if test -s $fail
 then
-	echo Some commits could not be rebased, check by hand:
-	cat $fail
+	echo >&2 Some commits could not be rebased, check by hand:
+	cat >&2 $fail
+	echo >&2 "(the same list of commits are found in $tmp)"
+	exit 1
+else
+	rm -f $fail
 fi

← back to recent threads