MCPcopy
hub / github.com/cli/cli / CheckoutBranch

Method CheckoutBranch

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

Source from the content-addressed store, hash-verified

616}
617
618func (c *Client) CheckoutBranch(ctx context.Context, branch string) error {
619 args := []string{"checkout", branch}
620 cmd, err := c.Command(ctx, args...)
621 if err != nil {
622 return err
623 }
624 _, err = cmd.Output()
625 if err != nil {
626 return err
627 }
628 return nil
629}
630
631func (c *Client) CheckoutNewBranch(ctx context.Context, remoteName, branch string) error {
632 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