getCurrentBranch returns the current git branch name.
()
| 87 | |
| 88 | // getCurrentBranch returns the current git branch name. |
| 89 | func getCurrentBranch() (string, error) { |
| 90 | out, err := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").Output() |
| 91 | if err != nil { |
| 92 | return "", fmt.Errorf("not in a git repository or git not available") |
| 93 | } |
| 94 | return strings.TrimSpace(string(out)), nil |
| 95 | } |
| 96 | |
| 97 | // extractItemRefFromBranch attempts to find a Pad item reference (e.g. TASK-5, BUG-3) in a branch name. |
| 98 | // |