This uses the new "git stash create" interface to stash away the dirty state
you have in your working tree before starting a rebase, and then replaying
it when you are done with stashing.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
# The tree must be clean enough for us to create a stash
stash=$(git stash create) || exit
if test -n "$stash"
then
echo >&2 "Stashed away your working tree changes"
fi
# If a hook exists, give it a chance to interrupt
if test -x "$GIT_DIR/hooks/pre-rebase"
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
echo >&2 "The pre-rebase hook refused to rebase."
test -z "$stash" || git stash apply --index "$stash"
exit 1
}
fi
@ -286,7 +315,10 @@ fi
@@ -286,7 +315,10 @@ fi
case "$#" in
2)
branch_name="$2"
git-checkout "$2" || usage
git-checkout "$2" || {
test -z "$stash" || git stash apply --index "$stash"
usage
}
;;
*)
if branch_name=`git symbolic-ref -q HEAD`
@ -309,6 +341,7 @@ if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
@@ -309,6 +341,7 @@ if test "$upstream" = "$onto" && test "$mb" = "$onto" &&