Class: Git::Lib::HeadState Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/git/lib.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The state and name of branch pointed to by HEAD

HEAD can be in the following states:

:active: HEAD points to a branch reference which in turn points to a commit representing the tip of that branch. This is the typical state when working on a branch.

:unborn: HEAD points to a branch reference that does not yet exist because no commits have been made on that branch. This state occurs in two scenarios:

  • When a repository is newly initialized, and no commits have been made on the initial branch.
  • When a new branch is created using git checkout --orphan <branch>, starting a new branch with no history.

:detached: HEAD points directly to a specific commit (identified by its SHA) rather than a branch reference. This state occurs when you check out a commit, a tag, or any state that is not directly associated with a branch. The branch name in this case is HEAD.

Instance Attribute Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



762
763
764
# File 'lib/git/lib.rb', line 762

def name
  @name
end

#stateObject

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



762
763
764
# File 'lib/git/lib.rb', line 762

def state
  @state
end