3 # Copyright (c) 2005 Junio C Hamano.
6 . git-sh-setup-script || die
"Not a git archive."
8 usage
="usage: $0 "'<upstream> [<head>]
10 Uses output from git-cherry to rebase local commits to the new head of
15 upstream
=$
(expr "$1" : '\(.*\)\.\.') ours
=$
(expr "$1" : '.*\.\.\(.*\)$')
16 set x
"$upstream" "$ours"
21 1) upstream
=`git-rev-parse --verify "$1"` &&
22 ours
=`git-rev-parse --verify HEAD` ||
exit
24 2) upstream
=`git-rev-parse --verify "$1"` &&
25 ours
=`git-rev-parse --verify "$2"` ||
exit
27 *) echo >&2 "$usage"; exit 1 ;;
30 git-read-tree
-m -u $ours $upstream &&
31 echo "$upstream" >"$GIT_DIR/HEAD" ||
exit
35 trap "rm -rf $tmp-*" 0 1 2 3 15
39 git-cherry
$upstream $ours |
40 while read sign commit
45 S
=`cat "$GIT_DIR/HEAD"` &&
46 GIT_EXTERNAL_DIFF
=git-apply-patch-script git-diff-tree
-p $commit &&
47 git-commit-script
-C "$commit" ||
{
49 git-read-tree
--reset -u $S
54 echo Some commits could not be rebased
, check by hand
: