MCPcopy Create free account
hub / github.com/cli/cli / CheckoutBranch

Method CheckoutBranch

git/client.go:678–689  ·  view source on GitHub ↗
(ctx context.Context, branch string)

Source from the content-addressed store, hash-verified

676}
677
678func (c *Client) CheckoutBranch(ctx context.Context, branch string) error {
679 args := []string{"checkout", branch}
680 cmd, err := c.Command(ctx, args...)
681 if err != nil {
682 return err
683 }
684 _, err = cmd.Output()
685 if err != nil {
686 return err
687 }
688 return nil
689}
690
691func (c *Client) CheckoutNewBranch(ctx context.Context, remoteName, branch string) error {
692 track := fmt.Sprintf("%s/%s", remoteName, branch)

Callers

nothing calls this directly

Calls 2

CommandMethod · 0.95
OutputMethod · 0.65

Tested by

no test coverage detected