MCPcopy Create free account
hub / github.com/github/gh-aw / createAndSwitchBranch

Function createAndSwitchBranch

pkg/cli/git.go:465–474  ·  view source on GitHub ↗

createAndSwitchBranch creates a new branch and switches to it

(branchName string, verbose bool)

Source from the content-addressed store, hash-verified

463
464// createAndSwitchBranch creates a new branch and switches to it
465func 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
477func switchBranch(branchName string, verbose bool) error {

Callers 4

applyPatchToRepoFunction · 0.85
CreatePRWithChangesFunction · 0.85
addWorkflowsWithPRFunction · 0.85

Calls 3

LogVerboseFunction · 0.92
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by 1