An easy-to-follow guide that helps you become a π better developer π by mastering the Conventional Commit standard for versioning in your projects.
By adopting Conventional Commits, it enhances your communication skills with clear, structured commit messages, helping you focus on the impact of your changes. This not only improves the way you work but also leads to smoother project management and better code quality, making collaboration more efficient.
You will use the git commit
command in your terminal when you make changes to your code and want to commit them using Conventional Commits. The key is to follow the Conventional Commit format for your commit messages.
In your terminal, run the following:
git commit -m "feat(booking): add Update Booking feature"
-
Make Changes: Modify your files as needed.
-
Stage Your Changes: Add your modified files to the staging area. git add Or to add all changed files at once: git add .
-
Commit with Conventional Commit Message: After staging the changes, use the following command to commit: git commit -m "feat(DataTable): add no data found message"
-
Push the Changes: Push your commits to the remote repository. git push Or if you are pushing to a specific branch: git push origin
Each commit message follows this structure:
- type: Describes the change (e.g.,
feat
,fix
,chore
) - scope: Optional. Refers to the area of the project being affected (e.g.,
api
,frontend
) - description: A short description of the change.
-
feat: A new feature for the system
Example:feat(Booking): add Update Booking feature
-
fix: A bug fix for the system
Example:fix(DataTable): resolve issue with DataTable filter state
-
chore: Routine tasks like maintenance or updating dependencies
Example:chore(deps): update antd to version 5.22.7
-
docs: Documentation updates
Example:docs(readme): update installation instructions
-
style: Changes related to code style (e.g., formatting, missing semi-colons)
Example:style(DataTable): fix item alignment in CSS
-
refactor: Code change that neither fixes a bug nor adds a feature
Example:refactor(usePageParams): simplify usePageParams hook
-
test: Adding or updating tests
Example:test(usePageParams): add unit tests for usePageParams hook
-
build: Changes that affect the build system or external dependencies
Example:build(vite): add vite config for production build
-
ci: Continuous integration-related changes
Example:ci(bitbucket): update CI config for deployment pipeline
For a deeper understanding of Conventional Commits, check out the official documentation: Conventional Commits.
- Keep your messages clear and concise.
- Use the type that best represents the change you made.
Written β€οΈ by SaroarShahan, made better by you.