- name
- commit-and-pr
- description
- Create git commits and GitHub/GitLab PRs/MRs using the user's safety protocol. Use when the user asks to commit, open a PR/MR, or push a reviewable branch.
# Commit and PR / MR
Only commit or open a PR when the user explicitly asks. Never push unless asked.
## Commit protocol
Run in parallel first:
```bash
git status
git diff
git log -5 --oneline
```
Then:
1. Draft a 1–2 sentence message focused on **why** (match repo style from `git log`).
2. Stage relevant files only (warn on secrets).
3. Run pre-commit if the repo has it; fix failures with a **new** commit (do not amend unless amend rules below all hold).
4. Commit via HEREDOC:
```bash
git commit -m "$(cat <<'EOF'
Message here.
EOF
)"
```
5. `git status` to verify.
### Amend — only if all true
- User asked to amend, **or** hooks auto-modified files after a successful commit you just made
- HEAD was created by you in this conversation
- Commit not pushed
- Otherwise: new commit
Never: `git config` changes, `--no-verify`, force-push to main, interactive rebase.
## Pull request (GitHub `gh`)
In parallel: `git status`, `git diff`, tracking/upstream check, `git log` + `git diff main...HEAD` (or repo default base).
Then push if needed (`git push -u origin HEAD`) and:
```bash
gh pr create --title "title" --body "$(cat <<'EOF'
## Summary
- …
## Test plan
- [ ] …
EOF
)"
```
Return the PR URL.
## Merge request (GitLab `glab`)
Prefer `glab` / GitLab MCP. **Ask confirmation before posting review notes.** Align description with `mr-pr-descriptions` rule or repo templates.
View on GitHub