A standard Git commit message format helps maintain clarity and consistency in a project. A widely used convention is the Conventional Commits format.
<type>(<scope>): <short description>
[Optional] <Detailed explanation of the changes>
[Optional] Closes #<issue-number> or References #<issue-number>
Type | Description |
---|---|
feat | A new feature |
fix | A bug fix |
chore | Maintenance tasks (e.g., refactoring, updates) |
docs | Documentation changes |
style | Formatting changes (whitespace, linting, missing semicolons) |
refactor | Code restructuring without changing behavior |
perf | Performance improvements |
test | Adding or updating tests |
ci | Changes to CI/CD configurations |
build | Changes to the build system or dependencies |
The scope specifies the part of the project affected by the change, like:
auth
models
views
database
api
ui
tests
git commit -m "feat(auth): add phone number login for students"
git commit -m "fix(database): resolve UUID validation error"
git commit -m "docs(readme): update setup instructions"
git commit -m "refactor(api): optimize image watermarking function"
git commit -m "chore(deps): update Django to 5.1"
git commit -m "test(auth): add unit tests for phone login"
git commit -m "ci(github-actions): add automated testing workflow"
If you have multiple related changes, you can provide a detailed explanation:
feat(users): add UUID-based authentication
- Replaced integer IDs with UUIDs for better security.
- Updated user model, serializers, and views accordingly.
- Updated database migration to support UUID primary keys.
Closes #42
Commit with:
git commit -m "feat(users): add UUID-based authentication" -m "- Replaced integer IDs with UUIDs for better security. - Updated user model, serializers, and views accordingly. - Updated database migration to support UUID primary keys."
After committing, push your changes:
git push origin main
or if you're on another branch:
git push origin <branch-name>
This format keeps your commit history clean, readable, and easy to track. 🚀