#!/bin/sh
-branch_name=$(git-symbolic-ref HEAD)
+branch_name=$(git symbolic-ref --quiet HEAD)
+if [[ $? -ne 0 ]] ; then
+ echo "not on a branch"
+ exit 1
+fi
+
+branch_name=${branch_name/refs\/heads\//}
git push origin $branch_name
if [[ $? -ne 0 ]] ; then