class Git::Commands::Branch::ShowCurrent

Implements the ‘git branch –show-current` command

Prints the name of the current branch. In detached HEAD state, nothing is printed.

@example Print the current branch name

show_current = Git::Commands::Branch::ShowCurrent.new(execution_context)
result = show_current.call
puts result.stdout  # => "main\n"

@example Check for detached HEAD state

show_current = Git::Commands::Branch::ShowCurrent.new(execution_context)
result = show_current.call
# result.stdout is empty ("") when in detached HEAD state

@note ‘arguments` block audited against git-scm.com/docs/git-branch/2.53.0

@see Git::Commands::Branch

@see git-scm.com/docs/git-branch git-branch

@api private