|
| 1 | +# Commit, Push, and Create PR |
| 2 | + |
| 3 | +Automate the git workflow for completing a feature or fix. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +``` |
| 8 | +/commit-push-pr [optional commit message] |
| 9 | +``` |
| 10 | + |
| 11 | +## Pre-computed Context |
| 12 | + |
| 13 | +Before proceeding, gather this information: |
| 14 | +- Current branch: `git branch --show-current` |
| 15 | +- Git status: `git status --short` |
| 16 | +- Recent commits on this branch: `git log --oneline -5` |
| 17 | +- Diff summary: `git diff --stat` |
| 18 | + |
| 19 | +## Workflow |
| 20 | + |
| 21 | +1. **Review Changes** |
| 22 | + - Check `git status` for all modified/added files |
| 23 | + - Review the diff to understand what's being committed |
| 24 | + - Ensure no sensitive files are staged (.env, credentials, etc.) |
| 25 | + |
| 26 | +2. **Run Pre-commit Checks** (if applicable) |
| 27 | + - For R files: Check syntax with `Rscript -e "parse(file='<file>')"` |
| 28 | + - Verify data files are compressed (.csv.gz, .parquet) |
| 29 | + |
| 30 | +3. **Stage and Commit** |
| 31 | + - Stage relevant files: `git add <files>` |
| 32 | + - Create a commit with Conventional Commits format: |
| 33 | + - `feat:` for new features (new data sources, new bundles) |
| 34 | + - `fix:` for bug fixes (data corrections, pipeline fixes) |
| 35 | + - `docs:` for documentation (CLAUDE.md, README updates) |
| 36 | + - `refactor:` for refactoring (code cleanup) |
| 37 | + - `data:` for data updates (new raw data, re-processed outputs) |
| 38 | + - `chore:` for maintenance (dependency updates) |
| 39 | + - Write a clear, concise commit message focusing on "why" |
| 40 | + - Include co-author line: `Co-Authored-By: Claude <noreply@anthropic.com>` |
| 41 | + |
| 42 | +4. **Push to Remote** |
| 43 | + - Push the branch: `git push -u origin HEAD` |
| 44 | + - If branch doesn't exist on remote, create it |
| 45 | + |
| 46 | +5. **Create Pull Request** |
| 47 | + - Use GitHub CLI: `gh pr create` |
| 48 | + - Include: |
| 49 | + - Clear title summarizing the change |
| 50 | + - Description with summary and context |
| 51 | + - Reference any related issues |
| 52 | + - Format PR body with: |
| 53 | + ``` |
| 54 | + ## Summary |
| 55 | + <1-3 bullet points> |
| 56 | +
|
| 57 | + ## Test plan |
| 58 | + [Bulleted checklist of testing steps] |
| 59 | +
|
| 60 | + 🤖 Generated with [Claude Code](https://claude.ai/code) |
| 61 | + ``` |
| 62 | +
|
| 63 | +## Arguments |
| 64 | +
|
| 65 | +Pass a commit message or leave empty for auto-generated message based on changes. |
| 66 | +
|
| 67 | +Example: `/commit-push-pr feat: add mmr_epic data source` |
| 68 | +
|
| 69 | +## Output |
| 70 | +
|
| 71 | +Return the PR URL when complete. |
0 commit comments