From git-plugin
Submit clean PRs to upstream repositories from forks by cherry-picking commits, creating branches from upstream/main, squashing changes, and supporting cross-fork PRs.
npx claudepluginhub laurigates/claude-plugins --plugin git-pluginThis skill is limited to using the following tools:
Submit clean, atomic PRs to upstream repositories from fork work.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Submit clean, atomic PRs to upstream repositories from fork work.
| Use this skill when... | Use /git:commit instead when... |
|---|---|
| Contributing changes back to the upstream repo | Committing to your own fork/repo |
| Cherry-picking fork commits for upstream PR | Creating a PR within the same repo |
| Fork's main has diverged from upstream | Fork and upstream are in sync |
| Need a clean branch based on upstream/main | Working on a branch already tracking upstream |
git branch --show-currentgit status --porcelain=v2 --branchgit remote -vgit remote get-url upstreamgit remote get-url origingit remote get-url upstreamgit log --oneline --max-count=20git stash listParse these from $ARGUMENTS:
| Parameter | Required | Description |
|---|---|---|
--commits sha1,sha2,... | No | Comma-separated commit SHAs to cherry-pick (interactive selection if omitted) |
--branch name | No | Name for the upstream PR branch (auto-generated if omitted) |
--upstream owner/repo | No | Override upstream repo (detected from remote if omitted) |
--draft | No | Create PR as draft |
--dry-run | No | Show what would happen without making changes |
Execute this fork-to-upstream PR workflow:
git rev-parse --git-dirupstream remote exists (from context)upstream remote:
gh repo view --json parent -q '.parent.nameWithOwner'git remote add upstream https://github.com/<owner/repo>.gitgit fetch upstreamgit stash push -m "upstream-pr: WIP before upstream PR"Report the fork's divergence from upstream:
Fork status:
Upstream: <upstream-repo>
Behind upstream/main: N commits
Ahead of upstream/main: M commits
If --dry-run is set, also show which commits would be selected and stop here.
If --commits provided:
git rev-parse --verify <sha>If --commits not provided:
git log --oneline --format='%h %s (%cr)' upstream/main..HEAD
--branch not provided:
feat(auth): add OAuth -> feat/auth-add-oauth)upstream-pr/<date>git switch -c <branch-name> upstream/main
git cherry-pick <sha1> <sha2> ...
git cherry-pick --continuegit reset --soft upstream/main
git commit -m "<conventional commit message>"
git push -u origin <branch-name>
If --dry-run, show the command without executing.
--upstream or detected remote)origin remote URL)gh pr create \
--repo <upstream-owner/upstream-repo> \
--base main \
--head <fork-owner>:<branch-name> \
--title "<conventional commit title>" \
--body "<PR description>"
Add --draft if the flag was provided.git switch <original-branch>
git stash pop
Upstream PR created:
PR: <url>
Branch: <branch-name>
Commits: N cherry-picked, squashed into 1
Original branch restored: <branch>
| Error | Recovery |
|---|---|
| Cherry-pick conflict | Show conflicted files, reference git-conflicts skill |
| Push rejected | Check if branch already exists on fork; suggest --branch override |
| No upstream remote | Auto-detect from gh repo view --json parent or ask user |
| Upstream/main not found | Try upstream/master; ask user for correct branch name |
| No commits ahead of upstream | Report "Nothing to contribute" and exit |
| Context | Command |
|---|---|
| Divergence check | git rev-list --left-right --count upstream/main...HEAD |
| Commits ahead | git log --oneline --format='%h %s' upstream/main..HEAD |
| Validate SHA | git rev-parse --verify --short <sha> |
| Fork owner | git remote get-url origin | sed -E 's#.*github.com[:/]##; s#\.git$##; s#/.*##' |
| Upstream repo | git remote get-url upstream | sed -E 's#.*github.com[:/]##; s#\.git$##' |
| Cross-fork PR | gh pr create --repo <upstream> --head <fork-owner>:<branch> |