def current_branch_state
      branch_name = command('branch', '--show-current')
      return HeadState.new(:detached, 'HEAD') if branch_name.empty?

      state =
        begin
          command('rev-parse', '--verify', '--quiet', branch_name)
          :active
        rescue Git::FailedError => e
          raise unless e.result.status.exitstatus == 1 && e.result.stderr.empty?

          :unborn
        end

      return HeadState.new(state, branch_name)
    end
The current branch state which is the state of `HEAD`

@return [HeadState] the state and name of the current branch