branch listing cmd

This commit is contained in:
daveberrys committed 2026-07-19 09:16:16 +08:00
1 parent f21745e063
commit e40387c817
2 files changed
+7 -1

No files matched your search

+2 -1
View File
@@ -214,9 +214,10 @@ Switch to an existing branch.
``` ```
guh switch branch <name> guh switch branch <name>
guh switch branch list
``` ```
Equivalent to `git switch <name>`. Equivalent to `git switch <name>`. Listing all branches is equivalent to `git branch`.
### `account` ### `account`
+5
View File
@@ -12,8 +12,13 @@ var switchBranchCmd = &cobra.Command{
Short: "Switch to a specific branch", Short: "Switch to a specific branch",
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error { RunE: func(c *cobra.Command, args []string) error {
if args[0] == "list" {
utils.RunGit(false, "branch")
} else {
utils.RunGitSequence(false, []string{"switch", args[0]}) utils.RunGitSequence(false, []string{"switch", args[0]})
fmt.Printf("Switched to branch: %s\n", args[0]) fmt.Printf("Switched to branch: %s\n", args[0])
}
return nil return nil
}, },
} }