Skip to main content

detect_default_branch

Function detect_default_branch 

Source
pub fn detect_default_branch(bare: &Path) -> Result<String>
Expand description

Detect the default branch of a bare remote repository.

Tries symbolic-ref refs/remotes/origin/HEAD, then git remote show origin, then 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.