Skip to content

Commit

Permalink
add create option (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 7, 2023
1 parent 3b8006d commit c2e5356
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ var switchCmd = &cobra.Command{
}
}

if createOption != "" {
if err := client.Refs.AddBranch(client.RootGoitPath, createOption, client.Head.Commit.Hash); err != nil {
return fmt.Errorf("fail to create new branch %s: %w", createOption, err)
}
if err := client.Head.Update(client.Refs, client.RootGoitPath, createOption); err != nil {
return fmt.Errorf("fail to update HEAD: %w", err)
}
}

return nil
},
}
Expand Down

0 comments on commit c2e5356

Please sign in to comment.