summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
new file mode 100755
index 0000000..5289762
--- /dev/null
+++ b/git-rebase.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano.
+#
+
+. git-sh-setup || die "Not a git archive."
+
+# The other head is given
+other=$(git-rev-parse --verify "$1^0") || exit
+
+# The tree must be really really clean.
+git-update-index --refresh || exit
+diff=$(git-diff-index --cached --name-status -r HEAD)
+case "$different" in
+?*) echo "$diff"
+ exit 1
+ ;;
+esac
+
+# If the branch to rebase is given, first switch to it.
+case "$#" in
+2)
+ git-checkout "$2" || exit
+esac
+
+# Rewind the head to "$other"
+git-reset --hard "$other"
+git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |
+git am --binary -3 -k