diff --git a/src/subcommands/local/create.rs b/src/subcommands/local/create.rs index b5f756d..7ec61d7 100644 --- a/src/subcommands/local/create.rs +++ b/src/subcommands/local/create.rs @@ -25,6 +25,11 @@ impl CreateCmd { None => inquire::Text::new("Name of new branch:").prompt()?, }; + // Check if the working tree is clean. + if !ctx.repository.is_working_tree_clean()? { + return Err(crate::errors::StError::WorkingTreeDirty); + } + // Attempt to create the new branch. ctx.repository .branch(&new_branch_name, ¤t_branch_head, false)?;