Get Default Branch
Overview
This skill retrieves the default branch name of the current Git repository using the GitHub CLI command gh repo view --json defaultBranchRef --jq .defaultBranchRef.name.
When to Use
Use this skill when:
- •The user requests the default branch name of the repository.
- •Performing git operations that require knowledge of the default branch (e.g., creating pull requests, comparing branches, checking out the base branch).
Usage
To get the default branch name, run the command:
bash
gh repo view --json defaultBranchRef --jq .defaultBranchRef.name
The command will output the default branch name (e.g., main, master, develop).