Add support for detached heads.
Merge remote-tracking branch 'kaecyra/master' into develop