Skip to main content

Commit Convention

G-RANK follows the Conventional Commits specification for all commit messages. This makes the history readable, enables automated changelogs, and clearly communicates intent.


Format​

<type>(<optional scope>): <description>

[optional body]

[optional footer]
  • type — what kind of change this is (required)
  • scope — what part of the codebase changed (optional but encouraged)
  • description — short imperative summary, lowercase, no period at the end
  • body — longer explanation if needed (why, not what)
  • footer — breaking changes, issue references

Types​

TypeWhen to UseExample
featA new featurefeat(auth): add email verification flow
fixA bug fixfix(lobby): prevent duplicate join on double-click
docsDocumentation changesdocs: update API endpoints reference
refactorCode restructuring (no behavior change)refactor(mmr): extract tier config to constants
testAdding or updating teststest(auth): add unit tests for login controller
choreBuild, CI, dependency updateschore: update mongoose to 9.2.0
styleFormatting, whitespace, no logic changestyle: apply prettier formatting
perfPerformance improvementsperf(leaderboard): add mmr index to users collection
ciCI/CD configuration changesci: add GitHub Actions workflow for testing
revertReverts a previous commitrevert: feat(auth): revert OAuth implementation

Real Examples from the Repository​

feat: add MMR calculation service with tier-based gain/loss rates
fix: update authentication error handling and improve user feedback in login process
fix: update .gitignore to include coverage directory and ensure .env is ignored
fix: update getAllLobbies test to include pagination parameters in API call
test: add unit tests for models, routes, and services

Use scopes to clarify which part of the system changed:

ScopeCovers
authAuthentication, registration, JWT
lobbyLobby creation, status management
participantLobby participant join/leave
matchMatch result submission
mmrMMR calculation, ranking
riotRiot Games API integration
adminAdmin panel
leaderboardLeaderboard query
frontendFrontend-only changes
backendBackend-only changes
docsDocumentation
depsDependency updates

Breaking Changes​

If a commit introduces a breaking change (e.g., API contract change, DB schema change), indicate it in the footer:

feat(auth)!: change JWT cookie name from 'jwt' to 'token'

BREAKING CHANGE: Clients storing or referencing the old cookie name 'jwt'
must update to 'token'. All existing sessions will be invalidated.

The ! after the type also signals a breaking change at a glance.


Why Conventional Commits?​

  1. Readable history — git log --oneline tells a clear story of changes.
  2. Automated changelogs — tools like conventional-changelog or release-it can generate changelogs automatically.
  3. Semantic versioning — feat → minor bump, fix → patch, breaking change → major.
  4. PR descriptions — well-structured commits make PR summaries easier to write.

Git Tips​

# View recent commits with conventional format
git log --oneline -20

# Amend the last commit message (before pushing)
git commit --amend -m "fix(auth): correct token expiry calculation"

# Interactive rebase to clean up commits before PR
git rebase -i HEAD~5