How /commit-push-pr Works
Save to .claude/commands/commit-push-pr.md:
---
description: Run status, commit, push, and open a PR in one shot
argument-hint: [PR title]
---
You will ship the current branch end-to-end. Follow this exact sequence — do not skip steps:
1. Run `git status --short` and `git diff --stat`. Show me the change summary.
2. Stage explicitly named files only — never `git add -A` or `.`. Skip `.env`, secrets, large binaries.
3. Generate a one-line commit message in conventional-commit form (feat:/fix:/refactor:/docs:). Lead with WHY, not WHAT.
4. Create the commit (NEVER amend, NEVER `--no-verify`).
5. If the local branch has no upstream, set it: `git push -u origin <branch>`.
6. Push.
7. Run `gh pr create`:
- Title: $ARGUMENTS if provided, else auto-generated from the commit message.
- Body: a short Summary section + a Test Plan checklist derived from the diff.
8. Print the PR URL.
Stop and ask me before:
- Force-pushing
- Pushing to main/master
- Committing more than 20 files at once (likely a stale workspace)Behavior contract
- Never amends a previously published commit.
- Never uses
--no-verifyto skip hooks. - Never stages with
-Aor.(security: avoids accidental secrets). - Always asks before pushing to main/master.
Example session
You: "/commit-push-pr Add multi-tenant audit logs"
Claude: -> git status: 4 files changed, 312 insertions
-> Stages: src/audit/{logger,schema}.ts tests/audit.spec.ts migrations/0042_audit.sql
-> Commit: "feat(audit): multi-tenant audit log with retention policy"
-> Push to origin/feat-audit-logs
-> gh pr create: PR #482 opened
-> https://github.com/acme/api/pull/482FAQ
Q: Will this git add -A?
A: No — it stages files by name. Avoids accidentally shipping .env or build artifacts.
Q: What if I'm on main/master? A: It will stop and ask before pushing. Pushing to main directly bypasses PR review.
Q: Does it amend the previous commit? A: Never. Always creates a NEW commit. Pre-commit hook failures result in a fresh commit, not an amend.
Q: Is this Boris's actual command? A: No — community-written equivalent. Boris's private slash command file is not open-sourced. This entry captures the documented pattern.
Q: Do I need GitHub CLI?
A: Yes — the PR step uses gh pr create. For GitLab, swap in glab mr create.