While using GitHub issues you must be within a working github repository, so it can interact with the repository's issues and pull requests.
$ gh sherpa --help
Usage:
sherpa [command]
Available Commands:
create-branch Create a local branch from an issue type
create-pr Create a pull request from the current local branch or issue type
help Help about any command
Flags:
-h, --help help for sherpa
-v, --version version for sherpa
-y, --yes use the default proposed fields
Use "sherpa [command] --help" for more information about a command.
Create a git branch associated to a GitHub or Jira issue.
gh sherpa create-branch, cb [flags]--issue, -i: GitHub or Jira issue identifier.
--base: Base branch for checkout. By default is the default branch.--no-fetch: Remote branches will not be fetched.--yes, -y: The branch will be created without confirmation.--fork: Automatically set up fork for external contributors.--fork-name: Specify custom fork organization/user (e.g. MyOrg/gh-sherpa).--prefer-hotfix: Prefer hotfix branch prefix for bug issues when using non-interactive mode (-y). For GitHub issues, this flag checks if thekind/buglabel is present anywhere in the issue's label list (not just as the first or primary label). When found, it creates ahotfix/branch instead ofbugfix/, regardless of the issue's detected type or other labels present.
# Create a branch name associated to a GitHub issue
gh sherpa create-branch --issue 17
# Create a branch name associated to a Jira issue
gh sherpa create-branch --issue SHERPA-31gh sherpa create-branch --issue 17 --yesgh sherpa create-branch --issue SHERPA-31 --base release/1.3.5 --no-fetchWhen using --prefer-hotfix, the tool scans all labels on the issue looking for kind/bug. If found anywhere in the label list, the branch will be created with a hotfix/ prefix instead of the default bugfix/ prefix. This works even if kind/bug is not the first label or if other type labels (like kind/feature, kind/internal) are also present.
# For a GitHub issue #17 with kind/bug label (in any position)
# Creates: hotfix/GH-17-issue-description
gh sherpa create-branch --issue 17 --yes --prefer-hotfix
# Works even if the issue has multiple labels like:
# ["priority/high", "kind/feature", "kind/bug", "component/api"]# One-command fork setup and branch creation
gh sherpa create-branch --issue 32 --fork
# Custom fork organization
gh sherpa create-branch --issue 45 --fork --fork-name MyOrg/gh-sherpaCreate a pull request associated to a GitHub or Jira issue.
gh sherpa create-pr, cpr [flags]--issue, -i: GitHub or Jira issue identifier.--base: Base branch for checkout. By default is the default branch.--no-fetch: Remote branches will not be fetched.--yes, -y: The pull request will be created without confirmation.--no-draft: The pull request will be created in ready for review mode. By default is in draft mode.--no-close-issue: The GitHub issue will not be closed when the pull request is merged. By default is closed.--template: Path to a pull request template file--fork: Automatically set up fork for external contributors.--fork-name: Specify custom fork organization/user (e.g. MyOrg/gh-sherpa).--prefer-hotfix: Prefer hotfix branch prefix for bug issues when using non-interactive mode (-y). For GitHub issues, this flag checks if thekind/buglabel is present anywhere in the issue's label list (not just as the first or primary label). When found, it creates ahotfix/branch instead ofbugfix/, regardless of the issue's detected type or other labels present.
# Create a pull request in draft-mode associated to a GitHub issue
gh sherpa create-pr -i 750
# Create a pull request in draft-mode associated to a Jira issue
gh sherpa create-pr -i SHERPA-71gh sherpa create-pr -i SHERPA-71 --yesgh sherpa create-pr --issue 750 --template docs/pull_request_template.mdgh sherpa create-prgh sherpa create-pr -i 750 --no-draftgh sherpa create-pr --issue SHERPA-81 --base maingh sherpa create-pr --issue 750 --no-close-issueWhen using --prefer-hotfix, the tool scans all labels on the issue looking for kind/bug. If found anywhere in the label list, the branch and pull request will be created with a hotfix/ prefix instead of the default bugfix/ prefix. This works even if kind/bug is not the first label or if other type labels are also present.
# For a GitHub issue #750 with kind/bug label (in any position)
# Creates: hotfix/GH-750-issue-description
gh sherpa create-pr --issue 750 --yes --prefer-hotfix
# Works even if the issue has multiple labels like:
# ["priority/high", "kind/feature", "kind/bug", "component/api"]# One-command fork setup and pull request creation
gh sherpa create-pr --issue 32 --fork
# Custom fork organization
gh sherpa create-pr --issue 45 --fork --fork-name MyOrg/gh-sherpaFor external contributors working via forks, Sherpa provides seamless fork management through the --fork flag. This feature automates the entire fork setup process.
You can set a default fork organization in your configuration file (~/.config/sherpa/config.yml):
github:
fork_organization: "MyOrg"First-time Fork Setup:
❯ gh sherpa create-branch -i 32 --fork
=> Detecting repository setup...
=> No fork detected. Creating fork danielfn/gh-sherpa...
✓ Fork created successfully
=> Setting up remotes (origin: fork, upstream: original)...
=> Setting default repository to upstream...
=> Fetching branches from fork...
=> Creating branch bugfix/GH-32-fix-link-to-cla...
✓ Ready to start working on issue #32!Subsequent Usage:
❯ gh sherpa create-branch -i 45 --fork
=> Fork already configured, creating branch...
=> Creating branch feature/GH-45-new-feature...
✓ Ready to start working on issue #45!- Detects repository state - Checks if already in a fork setup
- Creates fork if needed - Runs
gh repo fork --remotewith user confirmation - Sets upstream as default - Runs
gh repo set-default <upstream-repo> - Fetches from fork - Runs
git fetch originto sync branches - Proceeds with standard operation - Creates branch/PR with correct remotes