Skip to main content

detect_branch

Function detect_branch 

Source
fn detect_branch(repo: &Repository) -> Option<String>
Expand description

Detects the current branch name.

Returns None if:

  • HEAD is detached (pointing directly to a commit)
  • HEAD is unborn (empty repository with no commits)