Handle detach HEAD cases