Skip to main content

detect_local_default_branch

Function detect_local_default_branch 

Source
pub fn detect_local_default_branch(repo: &Path) -> Result<String>
Expand description

Detect the current branch of a local (non-bare) repository.

Uses git rev-parse --abbrev-ref HEAD and falls back to checking main, master, and develop in that order.

ยงErrors

Returns an error if any git command fails to spawn or if the default branch cannot be determined.