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"
20 git-update-cache --refresh || exit
23 1) ours_symbolic=HEAD ;;
24 2) ours_symbolic="$2" ;;
28 upstream=`git-rev-parse --verify "$1"` &&
29 ours=`git-rev-parse --verify "$ours_symbolic^` || exit
30 test "$(git-diff-cache --cached "$ours")" = "" ||
31 die "Your working tree does not match $ours_symbolic."
33 git-read-tree -m -u $ours $upstream &&
34 git-rev-parse --verify "$upstream^0" >"$GIT_DIR/HEAD" || exit
38 trap "rm -rf $tmp-*" 0 1 2 3 15
42 git-cherry $upstream $ours |
43 while read sign commit
48 S=`cat "$GIT_DIR/HEAD"` &&
49 GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p $commit &&
50 git-commit-script -C "$commit" || {
52 git-read-tree --reset -u $S
57 echo Some commits could not be rebased, check by hand: