get_default

Function get_default 

Source
pub fn get_default() -> Result<String>
Expand description

Retrieves the default branch name from the Git repository.

Iterates over all configured remotes and returns the branch name pointed to by the first valid refs/remotes/{remote}/HEAD reference.

ยงErrors

  • If the repository cannot be opened.
  • If no remote has a valid HEAD reference.
  • If the branch name cannot be extracted from the reference target.