get the branch hash if it is detached