Skip to content

Commit

Permalink
git-rebase: allow rebasing a detached HEAD.
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 21, 2007
1 parent 11a6ddb commit bcf3161
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-rebase.sh
Expand Up @@ -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
Expand Down

0 comments on commit bcf3161

Please sign in to comment.