Contributing to R-Type
Welcome to the R-Type project! This guide will help you understand how to contribute effectively to the project, particularly regarding our commit message conventions.
Table of Contents
- Commit Message Convention
- Commit Types
- Commit Structure
- Examples
- Best Practices
- Programming Case Types
- FAQ
Commit Message Convention
We follow the Conventional Commits 1.0.0 specification to maintain a clear and structured commit history. This convention makes it easier to:
- Automatically generate CHANGELOGs
- Determine semantic version bumps
- Communicate changes clearly to the team
- Trigger automated build and publish processes
- Navigate and understand project history
Commit Types
Required Types
| Type | Description | Semantic Versioning |
|---|---|---|
feat |
Introduces a new feature to the codebase | MINOR version bump |
fix |
Patches a bug in the codebase | PATCH version bump |
Additional Types
| Type | Description | Example Use Case |
|---|---|---|
docs |
Documentation changes only | Update README, add comments |
style |
Code style changes (formatting, whitespace) | Run code formatter, fix indentation |
refactor |
Code refactoring without feature or bug changes | Rename variables, restructure code |
perf |
Performance improvements | Optimize algorithms, reduce memory usage |
test |
Add or update tests | Add unit tests, fix test cases |
build |
Changes to build system or dependencies | Update CMakeLists.txt, add libraries |
ci |
Changes to CI/CD configuration | Update GitHub Actions, Docker configs |
chore |
Other changes that don't modify src or test files | Update .gitignore, maintenance tasks |
Breaking Changes
A BREAKING CHANGE introduces an incompatible API change and correlates with a MAJOR version bump. It can be indicated in two ways:
- Add
!after the type/scope:feat!:orfeat(api)!: - Add a
BREAKING CHANGE:footer in the commit body
Commit Structure
Basic Format
Components
1. Type (REQUIRED)
A noun describing the nature of the change: feat, fix, docs, etc.
2. Scope (REQUIRED)
A noun describing the section of the codebase affected, enclosed in parentheses:
feat(server): add new matchmaking system
fix(client): resolve rendering issue
docs(api): update protocol documentation
Common scopes in R-Type:
- server - Server-side changes
- client - Client-side changes
- engine - Game engine modifications
- network - Networking layer changes
- api - API changes
- ui - User interface updates
3. Description (REQUIRED)
A short summary of the changes:
- Must immediately follow the colon and space
- Use imperative mood: "add" not "added" or "adds"
- Don't capitalize the first letter
- No period (.) at the end
- Maximum 72 characters recommended
✅ Good:
❌ Bad:
4. Body (OPTIONAL)
Provides additional context about the changes:
- Must begin one blank line after the description
- Free-form text, can span multiple paragraphs
- Explain what and why, not how
5. Footer(s) (OPTIONAL)
Additional metadata, provided one blank line after the body:
- References to issues:
Refs: #123 - Breaking changes:
BREAKING CHANGE: description - Reviewers:
Reviewed-by: Name
Examples
Simple Commit (No Body)
Commit with Body
git commit -m "fix(dev): resolve player synchronization issues
Introduce request ID and reference to latest state update.
Dismiss incoming updates that are outdated.
Refs: #456"
Breaking Change (with !)
Breaking Change (with footer)
git commit -m "feat(dev): redesign configuration system
BREAKING CHANGE: configuration file format changed from JSON to YAML.
Users must migrate their config files."
Complete Example
git commit -m "fix(server): prevent racing of client requests
Introduce a request ID and a reference to latest request. Dismiss
incoming responses other than from latest request.
Remove timeouts which were used to mitigate the racing issue but are
obsolete now.
Reviewed-by: John Doe
Refs: #789"
Best Practices
✅ DO
- Keep commits atomic: One logical change per commit
- Write clear descriptions: Be specific about what changed
- Use the imperative mood: "add feature" not "added feature"
- Reference issues: Include issue numbers in footers when applicable
- Be consistent: Follow the convention for every commit
# ✅ Good - Clear and specific
git commit -m "feat(client): add fullscreen toggle in settings menu"
# ✅ Good - Proper scope usage
git commit -m "fix(network): resolve packet loss on high latency"
# ✅ Good - Breaking change properly indicated
git commit -m "refactor(api)!: rename Player class to GameEntity"
❌ DON'T
- Vague descriptions: Avoid generic messages
- Mix multiple changes: Don't combine unrelated changes
- Ignore the format: Always follow the convention
- Write novels: Keep descriptions concise
# ❌ Bad - Too vague
git commit -m "fix stuff"
# ❌ Bad - No type
git commit -m "updated the server code"
# ❌ Bad - Mixed changes
git commit -m "feat: add login system, fix bug, update docs"
# ❌ Bad - Wrong mood
git commit -m "feat: added new feature"
FAQ
What if my commit fits multiple types?
Go back and split your changes into multiple commits. This is a benefit of Conventional Commits - it encourages organized commits.
# Split into separate commits:
git add src/server/auth.cpp
git commit -m "feat(server): add authentication system"
git add tests/auth_test.cpp
git commit -m "test(server): add tests for authentication"
git add docs/auth.md
git commit -m "docs(docs): add authentication documentation"
Should I use uppercase or lowercase for types?
Use lowercase for consistency. While any casing is allowed by the spec, our project uses lowercase.
# ✅ Correct
git commit -m "feat(main): add new feature"
# ❌ Avoid
git commit -m "FEAT(main): add new feature"
What if I made a mistake in my commit message?
Before pushing:
# Amend the last commit message
git commit --amend -m "fix(client): correct typo in shader code"
# Or edit multiple commits interactively
git rebase -i HEAD~3
After pushing: - Contact the team lead for guidance - Minor mistakes in commit messages are not critical
Do all contributors need to follow this?
Yes! All commits to the repository should follow the Conventional Commits specification. If you're squashing commits during a pull request merge, the final squashed commit must follow the convention.
How do I handle revert commits?
Use the revert type and reference the commit being reverted:
Workflow Example
Here's a complete workflow for contributing:
-
Create a feature branch:
-
Make your changes and commit following the convention:
-
Push your branch:
-
Create a Pull Request on GitHub following the PR template
-
Wait for review and merge
Programming Case Types
| Type | Case used | Example |
|---|---|---|
class and struct |
👨🔬 PascalCase PascalCase |
class EntityManager or struct MovementPattern |
| Methods and variables | 🐫 camelCase |
std::string getEntityName() or int entityId |
Variables in class |
🐫 camelCase but with a _ before the variable name |
std::size_t _entityId |
Need Help?
If you have questions about contributing:
- Open an issue on GitHub with the
questionlabel - Ask in the team chat
- Check existing commits for examples:
git log --oneline
Thank you for contributing to R-Type! 🚀