1#!/bin/sh2#3# Copyright (c) 2005 Junio C Hamano.4#56. git-sh-setup || die "Not a git archive."78# The other head is given9other=$(git-rev-parse --verify "$1^0") || exit1011# The tree must be really really clean.12git-update-index --refresh || exit13diff=$(git-diff-index --cached --name-status -r HEAD)14case "$different" in15?*) echo "$diff"16exit 117;;18esac1920# If the branch to rebase is given, first switch to it.21case "$#" in222)23git-checkout "$2" || exit24esac2526# Rewind the head to "$other"27git-reset --hard "$other"28git-format-patch -k --stdout --full-index "$other" ORIG_HEAD |29git am --binary -3 -k