Skip to main content

create_branch

Function create_branch 

Source
pub fn create_branch(dir: &Path, name: &str) -> Result<(), String>
Expand description

Create a new branch and switch to it (git switch -c <name>). Returns Ok(()) on success, or the captured stderr on failure (e.g. the name already exists or is invalid).

ยงErrors

Returns the trimmed stderr text when git switch -c exits non-zero or cannot run.