Create or update a GitHub pull request after committing and pushing changes. Use when the user asks to create a PR, submit changes for review, or open a pull request.
BRANCH_NAME=$(git branch --show-current)
git status --porcelain
git fetch origin
git rev-list HEAD --not origin/main --count
| On main? | Uncommitted changes? | Action |
|---|---|---|
| Yes | Yes | Create new branch, commit via /git-commit, then create PR |
| Yes | No | Error — nothing to PR |
| No | Yes | Commit on current branch via /git-commit, then create PR |
| No | No | Already committed — proceed to push and create PR |
Auto-generate a branch name with a meaningful prefix. Do NOT ask the user.
| Prefix | Usage |
|---|---|
feat/ | new example or tensor function |
fix/ | bug fix |
docs/ | documentation changes |
ci/ | CI/CD changes |
refactor/ | restructuring |
git checkout -b <branch-name>
Delegate to /git-commit skill.
gh pr list --head "$BRANCH_NAME" --state open
If PR already exists, display with gh pr view and exit.
git fetch origin
git rebase origin/main
git push --set-upstream origin "$BRANCH_NAME"
After rebase (if already pushed):
git push --force-with-lease origin "$BRANCH_NAME"
gh pr create \
--title "Brief description of changes" \
--body "$(cat <<'EOF'
## Summary
- Key change 1
- Key change 2
## Testing
- [ ] Example runs successfully
- [ ] Code follows pypto frontend coding style
EOF
)"
Rules:
| Issue | Solution |
|---|---|
| PR already exists | gh pr view then exit |
| Merge conflicts | Resolve, git add, git rebase --continue |
| Push rejected | git push --force-with-lease |
| gh not authenticated | Tell user to run gh auth login |
/git-commitorigin/main