Add ability to handle various additional detached head checkout scenarios. Add tests for those scenarios and documentation for how the version is determined