Skip to main content

detect_default_branch

Function detect_default_branch 

Source
pub fn detect_default_branch(repo: Option<&Path>) -> String
Expand description

Auto-detect the repository’s default branch.

Priority:

  1. origin/HEAD symref (most reliable — set by git clone)
  2. Local main branch exists
  3. Local master branch exists
  4. Config fallback