Don't unnecessarily detach HEADs if avoidable. Closes #2.