# Remove '--config' from args, otherwise it goes to the commit log
params="`echo $* | sed -e 's/--config//'`"
+ # Avoid detached HEAD
+ if $GIT branch | grep -q '^* (HEAD detached'; then
+ echo "Beware: trying to commit in detached HEAD state; checkout to a branch first"
+ exit 1
+ fi
+
# If there are no staged files, commit everything.
# Otherwise commit just what was staged
if $GIT status --short | grep -q "^[AM]"; then