Add support for detached heads.