Handle detached heads in prompt