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