Skip to main content

remote_branch_exists

Function remote_branch_exists 

Source
pub fn remote_branch_exists(branch: &str) -> Result<bool>
Expand description

Check if a branch exists on remote origin.

Returns Ok(true) / Ok(false) only when the answer is definitive: git ls-remote --exit-code exits 0 when the ref exists and 2 when it provably does not. Any other exit (no origin, network/auth failure) is returned as an Err so callers can distinguish “not there” from “couldn’t check” — the latter must never be treated as safe-to-delete.