Why the duplicate code?

Beside this, how would the log be valued if `Checkout()` was called with a detached `repo.Head` as a parameter? As a `DetachedHead` derives from `Branch`, it may produce unexpected result.