Git Workflow
Route the requested operation to the skill that owns it. Carry the user's scope, prior authorization, and completed actions through each handoff. When a caller already owns a phase such as CI monitoring, return results to it instead of recursively starting that phase.
Scope and Discovery
Inspection and review requests produce findings. Posting comments, changing PRs, or publishing branches requires authorization from the task. A request to commit or publish the task's changes covers staging those changes; preserve unrelated changes and ask only if ownership or the intended selection remains ambiguous.
Run only the probes needed for the current operation:
- Local changes:
git status --shortand the relevant staged or unstaged diff. - Current branch:
git branch --show-current. - Current PR:
gh pr view --json number,url,state,baseRefName,headRefName,headRefOid. If unavailable, query open PRs for the resolved head branch. Distinguish an empty successful query from authentication, network, or repository errors. - Default branch:
gh repo view --json defaultBranchRef --jq .defaultBranchRef.name. - Before rebase, push, or PR creation: inspect
gh stack view --jsonusing stacked-pr. A failed probe leaves membership unknown; resolve the failure before applying single-branch operations.
Reuse observations until a relevant write or concurrent update invalidates them. For history-rewriting pushes, establish affected branches, remote tips, and PRs. Proceed when existing authorization covers that impact; otherwise prepare and verify the local result before requesting approval for the concrete push.
Routing
| Intent | Workflow | | --------------------------------------- | -------------------------------------------------------------------- | | Inspect local state or diff | Run relevant read-only probes and report evidence | | Commit | Follow Commit below | | Create a PR | Follow Create PR below | | Push or update a PR | Follow Push below | | Rebase | Follow Rebase below | | Synchronize or repair a stack | stacked-pr | | Split a PR or organize commits | reorganize-diff | | Draft an issue or PR | prepare-issue-pr | | Review a PR or post authorized feedback | github-pr-review-operation | | Inspect chronological issue/PR events | gh-timeline | | Investigate or repair CI | fix-github-actions-ci | | Wait for CI | watch-ci |
Commit
- Inspect the diff and select the changes covered by the request.
- Stage the selected paths or hunks and inspect the staged diff.
- Use contextual-commit for the message.
- Commit and verify the resulting commit and remaining worktree state. Hook failures are failed checks to resolve, not evidence that a commit succeeded.
Completion: the intended changes exist in a verified commit and unrelated work remains preserved.
Create PR
- Commit the intended pending changes when needed.
- Use
reorganize-diffPhase 1 to check review boundaries. If no split is needed, continue. If execution would materially expand the requested PR structure, present the concrete split before requesting direction. - For an existing or newly created stack, use
stacked-prandgh-stackfor publication. Reuse PRs or pushes already completed by reorganization. - For a single PR, use
prepare-issue-prto finalize title, body, and base, then push the branch and create a draft PR. Use--body-filefor multiline text. Make it ready for review only when requested. - For a single PR, use
adjust-pr-baseto verify its base. Usewatch-ciafter publication and pass any observation-only constraint.
Completion: report the verified PR URL, base, and CI outcome. Pending, absent, or blocked checks remain explicit; PR creation alone does not establish CI success.
Push
- Commit authorized changes if needed. For a stack, route to
stacked-pr. - Push only if the current commits have not already been published.
- Inspect the PR title and body; use
prepare-issue-prto update stale metadata within the requested PR update. - Use
watch-cifor the published revision.
Completion: the remote revision matches the intended local revision, metadata describes the current change, and the CI outcome is reported.
Rebase
- Resolve the target base and stack membership. Route stacks to
stacked-pr. - For a single branch, preserve existing work and record the original tip, fetch the target, and rebase. Use resolving-merge-conflicts for an in-progress conflict; that skill does not initiate or publish the rebase.
- Inspect the resulting diff and run checks appropriate to conflict resolutions.
- Publish only within the requested scope, using
--force-with-leasewhen rewriting an existing remote branch. Verify the PR base withadjust-pr-basewhen relevant. - After publication, use
watch-ci.
Completion: the branch contains the intended base and changes without unresolved conflicts; report whether publication was requested and performed.