|
| 1 | +--- |
| 2 | +description: Git Conventions: Guidelines for commit messages, branch naming, and version control practices |
| 3 | +alwaysApply: false |
| 4 | +--- |
| 5 | + |
| 6 | +# Git Commit and Version Control Conventions |
| 7 | + |
| 8 | +## Commit Message Format |
| 9 | + |
| 10 | +This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. This format enables automatic changelog generation, version bumping, and better collaboration. |
| 11 | + |
| 12 | +### Structure |
| 13 | + |
| 14 | +```text |
| 15 | +<type>(<scope>): <subject> |
| 16 | + |
| 17 | +[optional body] |
| 18 | + |
| 19 | +[optional footer(s)] |
| 20 | +``` |
| 21 | + |
| 22 | +### Type |
| 23 | + |
| 24 | +The type must be one of the following: |
| 25 | + |
| 26 | +- `feat` - A new feature for the user |
| 27 | +- `fix` - A bug fix |
| 28 | +- `docs` - Documentation only changes |
| 29 | +- `style` - Changes that don't affect the meaning of code (white-space, formatting, etc.) |
| 30 | +- `refactor` - Code change that neither fixes a bug nor adds a feature |
| 31 | +- `perf` - Code change that improves performance |
| 32 | +- `test` - Adding missing tests or correcting existing tests |
| 33 | +- `build` - Changes that affect the build system or external dependencies |
| 34 | +- `ci` - Changes to CI configuration files and scripts |
| 35 | +- `chore` - Other changes that don't modify src or test files |
| 36 | +- `revert` - Reverts a previous commit |
| 37 | + |
| 38 | +### Scope |
| 39 | + |
| 40 | +The scope should be the name of the package or area affected. For this monorepo: |
| 41 | + |
| 42 | +**Apps:** |
| 43 | + |
| 44 | +- `desktop` - Desktop application |
| 45 | + |
| 46 | +### Subject |
| 47 | + |
| 48 | +The subject contains a succinct description of the change: |
| 49 | + |
| 50 | +- Use the imperative, present tense: "change" not "changed" nor "changes" |
| 51 | +- Don't capitalize the first letter |
| 52 | +- No period (.) at the end |
| 53 | +- Keep it under 72 characters |
| 54 | + |
| 55 | +### Body (Optional) |
| 56 | + |
| 57 | +The body should include the motivation for the change and contrast this with previous behavior. |
| 58 | + |
| 59 | +- Use the imperative, present tense |
| 60 | +- Wrap at 72 characters |
| 61 | +- Separate from subject with a blank line |
| 62 | + |
| 63 | +### Footer (Optional) |
| 64 | + |
| 65 | +The footer should contain information about Breaking Changes and reference issues that this commit closes. |
| 66 | + |
| 67 | +**Breaking Changes** should start with `BREAKING CHANGE:` followed by a description. |
| 68 | + |
| 69 | +**Closes** references should be on a separate line and use the format: `Closes #123, #456` |
| 70 | + |
| 71 | +## Examples |
| 72 | + |
| 73 | +### Feature Addition |
| 74 | + |
| 75 | +```text |
| 76 | +feat(desktop): add mod conflict detection |
| 77 | + |
| 78 | +Implement visual indicators for mod conflicts and add conflict |
| 79 | +resolution suggestions to the UI. |
| 80 | + |
| 81 | +Closes #142 |
| 82 | +``` |
| 83 | + |
| 84 | +### Bug Fix |
| 85 | + |
| 86 | +```text |
| 87 | +fix(api): handle edge case in pagination |
| 88 | + |
| 89 | +Fix incorrect offset calculation when page size exceeds total items. |
| 90 | +This prevents API errors when requesting pages beyond available data. |
| 91 | +``` |
| 92 | + |
| 93 | +### Breaking Change |
| 94 | + |
| 95 | +```text |
| 96 | +feat(api)!: remove deprecated v1 endpoints |
| 97 | + |
| 98 | +BREAKING CHANGE: The /v1/mods endpoint has been removed. All clients |
| 99 | +must migrate to the /v2/mods endpoint which provides better filtering |
| 100 | +and pagination support. |
| 101 | + |
| 102 | +Migration guide available at docs/migration/v1-to-v2.md |
| 103 | +``` |
| 104 | + |
| 105 | +### Dependency Update |
| 106 | + |
| 107 | +```text |
| 108 | +chore(deps): update @tauri-apps/api to v2.1.0 |
| 109 | +``` |
| 110 | + |
| 111 | +### Documentation |
| 112 | + |
| 113 | +```text |
| 114 | +docs(readme): add installation instructions for Linux |
| 115 | +``` |
| 116 | + |
| 117 | +### Multiple Scopes |
| 118 | + |
| 119 | +```text |
| 120 | +refactor(desktop,shared): extract mod validation logic to shared package |
| 121 | +``` |
| 122 | + |
| 123 | +### Simple Fix |
| 124 | + |
| 125 | +```text |
| 126 | +fix(www): correct button alignment on mobile |
| 127 | +``` |
| 128 | + |
| 129 | +## Branch Naming Conventions |
| 130 | + |
| 131 | +### Branch Format |
| 132 | + |
| 133 | +```text |
| 134 | +<type>/<ticket-or-description> |
| 135 | +``` |
| 136 | + |
| 137 | +### Types |
| 138 | + |
| 139 | +- `feature/` - New features |
| 140 | +- `bugfix/` - Bug fixes |
| 141 | +- `hotfix/` - Critical fixes that need immediate deployment |
| 142 | +- `refactor/` - Code refactoring |
| 143 | +- `chore/` - Maintenance tasks |
| 144 | +- `docs/` - Documentation updates |
| 145 | + |
| 146 | +### Branch Naming Rules |
| 147 | + |
| 148 | +- Use kebab-case for descriptions |
| 149 | +- Include ticket/issue numbers when applicable |
| 150 | +- Keep names descriptive but concise |
| 151 | +- Use lowercase letters |
| 152 | + |
| 153 | +### Branch Examples |
| 154 | + |
| 155 | +```bash |
| 156 | +# With ticket number |
| 157 | +feature/KR-123-add-mod-collections |
| 158 | +bugfix/KR-456-fix-download-crash |
| 159 | +hotfix/KR-789-security-patch |
| 160 | + |
| 161 | +# Without ticket number |
| 162 | +feature/dark-mode-toggle |
| 163 | +bugfix/pagination-edge-case |
| 164 | +refactor/extract-validation-logic |
| 165 | +chore/update-dependencies |
| 166 | +docs/add-api-examples |
| 167 | +``` |
| 168 | + |
| 169 | +## Gathering Git Context |
| 170 | + |
| 171 | +Run this single command to gather all necessary information: |
| 172 | + |
| 173 | +```bash |
| 174 | +echo "=== BRANCH ===" && git rev-parse --abbrev-ref HEAD && echo "=== STAGED FILES ===" && git diff --staged --stat && echo "=== STAGED CHANGES ===" && git diff --staged |
| 175 | +``` |
| 176 | + |
| 177 | +This provides: |
| 178 | + |
| 179 | +- Current branch name |
| 180 | +- Staged files summary → determine scope (which workspace/package) |
| 181 | +- Actual changes → determine commit type and write description |
| 182 | + |
| 183 | +### Changesets Integration |
| 184 | + |
| 185 | +This project uses changesets for version management. See [090-changesets.mdc](mdc:.cursor/rules/090-changesets.mdc) for details on when and how to create changesets alongside commits. |
| 186 | + |
| 187 | +## References |
| 188 | + |
| 189 | +- [Conventional Commits Specification](https://www.conventionalcommits.org/) |
| 190 | +- [Semantic Versioning](https://semver.org/) |
| 191 | +- [Keep a Changelog](https://keepachangelog.com/) |
| 192 | +- [Project Changeset Guidelines](mdc:.cursor/rules/090-changesets.mdc) |
0 commit comments