Small code refactoring
Make amend on orphaned head throw OrphanedHeadException
Enforce reflog writing test coverage
Test reflog writing when HEAD is detached