create_branch_and_switch

Function create_branch_and_switch 

Source
pub(crate) fn create_branch_and_switch(branch_name: &str) -> Result<()>
Expand description

Creates a new local branch (if desired) and switches to it.

Behaviour:

  • if both the current branch and the target branch are non‑default (not main / master) user confirmation is required.

§Errors

  • Current branch discovery via [ytil_git::branch::get_current] fails.
  • Branch creation via [ytil_git::branch::create_from_default_branch] or subsequent switching via [ytil_git::branch::switch] fails.
  • Reading user confirmation input fails.