arguments cleanup and some formatting
[git/dscho.git] / git-rebase.sh
blob5289762883f07e2737e1dbf3acfa106d101687f3
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano.
6 . git-sh-setup || die "Not a git archive."
8 # The other head is given
9 other=$(git-rev-parse --verify "$1^0") || exit
11 # The tree must be really really clean.
12 git-update-index --refresh || exit
13 diff=$(git-diff-index --cached --name-status -r HEAD)
14 case "$different" in
15 ?*) echo "$diff"
16 exit 1
18 esac
20 # If the branch to rebase is given, first switch to it.
21 case "$#" in
23 git-checkout "$2" || exit
24 esac
26 # Rewind the head to "$other"
27 git-reset --hard "$other"
28 git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
29 git am --binary -3 -k