createAndSwitchBranch creates a new branch and switches to it
(branchName string, verbose bool)
| 463 | |
| 464 | // createAndSwitchBranch creates a new branch and switches to it |
| 465 | func createAndSwitchBranch(branchName string, verbose bool) error { |
| 466 | console.LogVerbose(verbose, "Creating and switching to branch: "+branchName) |
| 467 | |
| 468 | cmd := exec.Command("git", "checkout", "-b", branchName) |
| 469 | if err := cmd.Run(); err != nil { |
| 470 | return fmt.Errorf("failed to create and switch to branch %s: %w", branchName, err) |
| 471 | } |
| 472 | |
| 473 | return nil |
| 474 | } |
| 475 | |
| 476 | // switchBranch switches to the specified branch |
| 477 | func switchBranch(branchName string, verbose bool) error { |