From: Junio C Hamano Date: Sun, 21 Jan 2007 03:11:29 +0000 (-0800) Subject: git-rebase: allow rebasing a detached HEAD. X-Git-Tag: v1.5.0-rc2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bcf316187699c5e97bf47c1b8a00c844bf809fbc;p=git.git git-rebase: allow rebasing a detached HEAD. Signed-off-by: Junio C Hamano --- diff --git a/git-rebase.sh b/git-rebase.sh index c8bd0f99d..99cedadda 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -275,8 +275,12 @@ case "$#" in git-checkout "$2" || usage ;; *) - branch_name=`git symbolic-ref HEAD` || die "No current branch" - branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'` + if branch_name=`git symbolic-ref -q HEAD` + then + branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'` + else + branch_name=HEAD ;# detached + fi ;; esac branch=$(git-rev-parse --verify "${branch_name}^0") || exit