create_from_default_branch

Function create_from_default_branch 

Source
pub fn create_from_default_branch(
    branch_name: &str,
    repo: Option<&Repository>,
) -> Result<()>
Expand description

Create a new local branch at current HEAD (no checkout).

Branch starts at the commit pointed to by HEAD; caller remains on the original branch.

§Errors

  • Repository discovery fails.
  • Resolving HEAD to a commit fails.
  • Branch already exists.

§Future Work

  • Optionally force (move) existing branch with a flag.
  • Support creating tracking configuration in one step.