|
| 1 | +--- |
| 2 | +name: managing-git-workflow |
| 3 | +description: Git workflow for HASH including branch naming, PR creation, and PR reviews. Use when creating branches, making commits, opening pull requests, or reviewing PRs. Covers Linear issue integration (H-XXXX format), PR templates, and review procedures. (project) |
| 4 | +--- |
| 5 | + |
| 6 | +# Managing Git Workflow |
| 7 | + |
| 8 | +## Purpose |
| 9 | + |
| 10 | +Standardized git workflow for HASH development, ensuring traceability between code changes and Linear issues. |
| 11 | + |
| 12 | +## When to Use |
| 13 | + |
| 14 | +- Creating a new branch for a feature or fix |
| 15 | +- Opening a pull request |
| 16 | +- Reviewing someone else's PR |
| 17 | +- Understanding PR conventions |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Branch Naming |
| 22 | + |
| 23 | +**Format:** `<shortname>/h-XXXX-description` |
| 24 | + |
| 25 | +- `shortname`: Your identifier (first initial, nickname, etc.) |
| 26 | +- `h-XXXX`: Linear ticket number (lowercase 'h') |
| 27 | +- `description`: Brief kebab-case description |
| 28 | + |
| 29 | +**Examples:** |
| 30 | + |
| 31 | +- `t/h-4892-support-baseurl-and-version-filter` |
| 32 | +- `alice/h-1234-add-user-authentication` |
| 33 | +- `bob/h-5678-fix-database-connection` |
| 34 | + |
| 35 | +**Why this matters:** |
| 36 | + |
| 37 | +- Links code changes to Linear issues |
| 38 | +- Enables progress tracking on tickets |
| 39 | +- Maintains clear development history |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Pull Request Creation |
| 44 | + |
| 45 | +### PR Title Format |
| 46 | + |
| 47 | +**Format:** `H-XXXX: Description` |
| 48 | + |
| 49 | +- Use uppercase 'H' in PR titles (unlike branch names) |
| 50 | +- Description should be clear and concise |
| 51 | + |
| 52 | +**Examples:** |
| 53 | + |
| 54 | +- `H-4922: Add branch naming instructions to CLAUDE.md` |
| 55 | +- `H-1234: Implement user authentication system` |
| 56 | +- `H-5678: Fix database connection timeout` |
| 57 | + |
| 58 | +### PR Template |
| 59 | + |
| 60 | +Use the template at `.github/pull_request_template.md`. Key sections: |
| 61 | + |
| 62 | +1. **Purpose** - High-level explanation of what and why |
| 63 | +2. **Related links** - Linear issues, discussions, context |
| 64 | +3. **What does this change?** - Specific implementation details |
| 65 | +4. **Pre-merge checklist:** |
| 66 | + - Publishable library changes (npm/Cargo) |
| 67 | + - Documentation requirements |
| 68 | + - Turbo Graph impact |
| 69 | +5. **Known issues** - Intentional omissions or limitations |
| 70 | +6. **Next steps** - Planned follow-ups |
| 71 | +7. **Tests** - What automated tests cover this |
| 72 | +8. **How to test** - Manual testing instructions |
| 73 | +9. **Demo** - Screenshots or videos |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## PR Review Process |
| 78 | + |
| 79 | +### Step 1: Gather Information |
| 80 | + |
| 81 | +Run these commands to get full context: |
| 82 | + |
| 83 | +```bash |
| 84 | +# View PR metadata, description, and comments |
| 85 | +gh pr view <PR_NUMBER> --comments |
| 86 | + |
| 87 | +# View ALL changes (don't truncate!) |
| 88 | +gh pr diff <PR_NUMBER> |
| 89 | + |
| 90 | +# View inline diff comments |
| 91 | +gh api \ |
| 92 | + -H "Accept: application/vnd.github+json" \ |
| 93 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 94 | + /repos/hashintel/hash/pulls/<PR_NUMBER>/comments |
| 95 | +``` |
| 96 | + |
| 97 | +**Important:** Always view the FULL diff. Don't pipe into `head` or use `--name-only`. |
| 98 | + |
| 99 | +### Step 2: Check Linear Issues |
| 100 | + |
| 101 | +Look for `H-XXXX` references in the PR title/description, then fetch the issue: |
| 102 | + |
| 103 | +```bash |
| 104 | +# If you have Linear MCP configured: |
| 105 | +mcp__linear__get_issue --issueId "H-XXXX" |
| 106 | + |
| 107 | +# Or use Linear web UI |
| 108 | +``` |
| 109 | + |
| 110 | +Use the Linear issue requirements as baseline for your review. |
| 111 | + |
| 112 | +### Step 3: Provide Feedback |
| 113 | + |
| 114 | +- Be precise about issue locations (file:line) |
| 115 | +- Include suggestions for improvement |
| 116 | +- Reference relevant code standards |
| 117 | +- Distinguish blocking issues from suggestions |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## Quick Reference |
| 122 | + |
| 123 | +| Action | Format | |
| 124 | +| ------------- | ------------------------------------------------------ | |
| 125 | +| Branch name | `<shortname>/h-XXXX-description` | |
| 126 | +| PR title | `H-XXXX: Description` | |
| 127 | +| View PR | `gh pr view <NUMBER> --comments` | |
| 128 | +| View diff | `gh pr diff <NUMBER>` | |
| 129 | +| View comments | `gh api /repos/hashintel/hash/pulls/<NUMBER>/comments` | |
0 commit comments