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

Method CheckoutBranch

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

Source from the content-addressed store, hash-verified

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

Callers 1

TestClientCheckoutBranchFunction · 0.95

Calls 2

CommandMethod · 0.95
OutputMethod · 0.65

Tested by 1

TestClientCheckoutBranchFunction · 0.76