No slash command · from git-plugin
Manages branch management and pull request workflows using modern Git commands and GitHub MCP integration. Guides main-branch development, remote feature branch pushes, and PR creation.
Ships in git-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
| Use this skill when... | Use the alternative when... |
|---|---|
| Designing the overall branch + PR workflow (main-branch dev, MCP integration) | Use git-branch-naming to pick or audit a single branch name |
Choosing between git switch, git restore, and feature-branch push patterns | Use git-rebase-patterns for linear-history cleanup and stacked PRs |
Creating PRs through GitHub MCP tools rather than gh pr create | Use git-pr to create PRs from a pushed branch via the gh CLI |
| Coordinating commit -> push -> PR end-to-end | Use git-commit-push-pr for the consolidated commit+push+PR macro |
Expert guidance for branch management, pull request workflows, and GitHub integration using modern Git commands and linear history practices.
git switch and git restore instead of checkoutDevelop directly on main, push to remote feature branches for PRs. This eliminates local branch management overhead.
# All work happens on main
git switch main
git pull origin main
# Make changes, commit on main
git add file.ts
git commit -m "feat(auth): add OAuth2 support"
# Push to remote feature branch (creates PR target)
git push origin main:feat/auth-oauth2
# Create PR using GitHub MCP (head: feat/auth-oauth2, base: main)
When you have commits for multiple PRs on main, push specific commit ranges to different remote branches:
# Commits on main:
# abc1234 feat(auth): add OAuth2 support <- PR #1
# def5678 feat(auth): add token refresh <- PR #1
# ghi9012 fix(api): handle timeout edge case <- PR #2
# Push first 2 commits to auth feature branch
git push origin abc1234^..def5678:feat/auth-oauth2
# Push remaining commit to fix branch
git push origin ghi9012^..ghi9012:fix/api-timeout
# Alternative: push from a specific commit to HEAD
git push origin def5678..HEAD:fix/api-timeout
Commit range patterns:
git push origin <start>^..<end>:<remote-branch> - Push commit range (inclusive)git push origin <commit>..<commit>:<remote-branch> - Push range (exclusive start)git push origin <commit>..HEAD:<remote-branch> - Push from commit to current HEADgit push origin main:<remote-branch> - Push entire main to remote branchUse git switch for branches and git restore for files instead of git checkout / git reset. See references/modern-git-commands.md for the forms and the legacy-to-modern migration table.
For comprehensive branch naming conventions including type prefixes, issue linking, and validation patterns, see git-branch-naming.
Quick reference: {type}/{issue}-{description} (e.g., feat/123-user-auth)
Main-branch development (above) is preferred. For a local feature branch (multi-day or experimental work), squash merging, and interactive rebase cleanup, see references/local-feature-branches.md.
For advanced rebase techniques including --reapply-cherry-picks, --update-refs, --onto, stacked PR workflows, and combining flags, see git-rebase-patterns.
Use GitHub MCP tools for all GitHub operations:
# Get repository information
mcp__github__get_me() # Get authenticated user info
# List and create PRs
mcp__github__list_pull_requests(owner="owner", repo="repo")
mcp__github__create_pull_request(
owner="owner",
repo="repo",
title="feat: add authentication",
head="feat/auth",
base="main",
body="## Summary\n- JWT authentication\n- OAuth support\n\nCloses #123"
)
# Update PRs
mcp__github__update_pull_request(
owner="owner",
repo="repo",
pullNumber=42,
title="Updated title",
state="open"
)
# List and create issues
mcp__github__list_issues(owner="owner", repo="repo")
Always force-push with --force-with-lease, never to main/shared branches. For the daily rebase-onto-main routine and rebase conflict handling, see references/local-feature-branches.md.
Configure branch rules for linear history via GitHub MCP:
# Require linear history (disable merge commits)
# Configure via GitHub settings or MCP tools
# - Require pull request reviews
# - Require status checks to pass
# - Enforce linear history (rebase and squash allowed, merge commits off)
Which of rebase or squash a given PR uses is decided per PR — rebase by
default, squash when there is a reason. Rule table and target repo settings:
github-pr-title → merge-strategies.md.
CRITICAL: When comparing branches for PR creation, always compare against origin/main (or origin/<base-branch>), never local main. Local main may contain commits that haven't been merged to the remote, causing PRs to include unrelated changes.
# WRONG: compares against local main (may include unpushed commits)
git log main..HEAD --format='%s'
git diff main...HEAD --stat
# CORRECT: compares against remote main (matches what GitHub will show)
git fetch origin main
git log origin/main..HEAD --format='%s'
git diff origin/main...HEAD --stat
Common scenario: You commit changes on local main for one PR, push to a feature branch, then start working on a second PR. If you compare against local main, the second PR's diff looks correct. But if the first PR hasn't merged yet, origin/main is behind — and comparing against it reveals that both PRs' changes would be included.
git fetch origin mainorigin/main in all diff/log commands for PR contextorigin/main when creating branches: git switch -c feat/foo origin/mainpr-context.sh script handles this automaticallyBefore creating a PR, gather all context in one command:
# Gather PR context (defaults to main as base, compares against origin/main)
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-branch-pr-workflow/scripts/pr-context.sh"
# Specify different base branch (compares against origin/develop)
bash "${CLAUDE_PLUGIN_ROOT}/skills/git-branch-pr-workflow/scripts/pr-context.sh" develop
The script fetches the latest remote state and compares against origin/<base> to ensure accurate PR context. Outputs: branch info, remote status, commit range and types, diff stats, issue references found in commits, existing PR detection, and CI check results. Use this output to compose the PR title and body. See scripts/pr-context.sh for details.
Use conventional commit format in PR titles:
feat: add user authenticationfix: resolve login validation bugdocs: update API documentationchore: update dependenciesWrite the body as a commit body. On repos whose squash_merge_commit_message
is PR_BODY (every laurigates repo except the release-please ones, see
merge-strategies.md), a
squash-merged PR's body becomes the commit body. No headings,
checklists or HTML comments:
<1–3 sentences: what changed and why>
- <key change>
- <key change>
Closes #123
Issue Reference Guidelines:
Closes #N / Fixes #N / Resolves #N to auto-close issues on mergeRefs #N for context without auto-closingFixes owner/repo#NFixes #1, fixes #2, fixes #3 (repeat keyword)Closes #123, Fixes #456, Resolves #789Refs #234, Related to #567Fixes owner/repo#123Fixes #1, fixes #2 (repeat keyword for each)For troubleshooting (branch diverged, committed-to-main expected workflow, complex rebase conflicts), safe-operation guidance (recognising normal states, confirmation-required commands), and recovery workflows (pre-commit modifies files, push rejected, commit fails), see REFERENCE.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
52 skills in this plugin
/deadbranchdeadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches./external-pr-trustAuthorship as a precondition of merging — bot vs stranger classification, what a merge executes, the merge-guard hook. Use when bulk-merging PRs, or when a merge is denied for a non-self author./gh-cli-agenticgh CLI commands with JSON output for agents. Use when querying PRs, issues, runs, or repo metadata; inspecting PR checks; fetching failed CI logs; or mapping a github.com URL to an API call.npx claudepluginhub laurigates/claude-plugins --plugin git-pluginOther plugins' skills for the same job