This guide provides essential conventions for naming Git branches and commit messages in KEC Computer Club repository. Use the following links to quickly navigate to the relevant sections:
This guide outlines the branch naming structure for our repository, ensuring clarity and organization for all contributors. Following these conventions will help streamline collaboration and maintain a clean codebase.
Each branch name should consist of a prefix followed by a description. The general structure is:
<prefix>/<description>
Let's break down each component:
The prefix indicates the type of work being done. Use one of the following predefined prefixes:
- feature/: For new features or enhancements.
- Example:
feature/add-login-page
- Example:
- bugfix/: For bug fixes.
- Example:
bugfix/fix-navigation-crash
- Example:
- hotfix/: For urgent fixes that require immediate attention.
- Example:
hotfix/update-security-patch
- Example:
- refactor/: For code restructuring without adding features or fixing bugs.
- Example:
refactor/restructure-database-code
- Example:
- enhancement/: For improving existing features.
- Example:
enhancement/improve-performance
- Example:
- chore/: For maintenance tasks (e.g., dependency updates).
- Example:
chore/update-dependencies
- Example:
- docs/: For documentation-related changes.
- Example:
docs/update-readme
- Example:
- test/: For adding or updating tests.
- Example:
test/add-unit-tests
- Example:
- style/: For purely cosmetic changes (e.g., formatting).
- Example:
style/fix-indentation
- Example:
- experimental/: For testing new ideas or designs.
- Example:
experimental/new-ui-design
- Example:
- release/: For preparing a new release.
- Example:
release/1.0.0
- Example:
The description should provide a concise summary of the branch's purpose. It should aim for clarity and brevity, avoiding unnecessary jargon. It should clearly communicate what the branch is about.
- Example:
bugfix/fix-login-error
is descriptive and clear.
- Be Consistent: Use the same prefixes and formatting across the project to avoid confusion.
- Keep It Short: Limit the description to a few words; avoid overly long names.
- Use Hyphens and Slashes: Hyphens improve readability, while slashes help categorize branches.
- Avoid Special Characters: Stick to alphanumeric characters, hyphens, and slashes to prevent issues in Git.
feature/add-user-profile
bugfix/fix-cart-total-calculation
hotfix/patch-security-vulnerability
- Use clear prefixes to indicate branch types.
- Keep descriptions concise and informative.
- Maintain consistent naming across the team.
- Avoid special characters and overly long names.
This convention will help maintain an organized and efficient repository for all contributors
This guide outlines the commit message structure for the KEC Computer Club website repository. Following this convention will make it easier for contributors to understand the purpose of changes and for future contributors to track issues or features.
Each commit message should consist of a type, and a short description. Optionally, you can include a optional scope, detailed body and footer. The general structure is:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Let's understand how to configure each of them. The structure includes:
The type indicates the nature of the change being committed. Use one of the following predefined types:
- feat: A new feature or enhancement.
- Example:
feat: add contact form connected with EmailJs and recaptcha service
- Example:
- fix: A bug fix.
- Example:
fix: resolve navigation crash on mobile
- Example:
- docs: Documentation changes only (e.g., updating README files).
- Example:
docs: update contribution guidelines
- Example:
- style: Code changes that do not affect logic (e.g., formatting, missing semi-colons, white-space).
- Example:
style: fix indentation in CSS
- Example:
- refactor: Code changes that neither add a feature nor fix a bug, but improve structure or performance.
- Example:
refactor: restructure user authentication module
- Example:
- test: Adding or updating tests.
- Example:
test: add unit tests for login component
- Example:
- chore: Maintenance tasks that don’t fit into other categories (e.g., updating dependencies or build scripts).
- Example:
chore: update npm packages
- Example:
- perf: A code change that improves performance.
- Example:
perf: optimize API call response time
- Example:
- build: Changes that affect the build system or external dependencies.
- Example:
build: update webpack configuration
- Example:
- ci: Changes to our CI configuration files and scripts.
- Example:
ci: add GitHub Actions for testing
- Example:
The scope specifies which part of the project is affected by the commit (e.g., a specific module or feature). Scopes help clarify the context of the change, but they are optional.
- Example with scope:
feat(events): add event registration page
- Example without scope:
feat: add event registration page
This way, the example better reflects the kind of work likely to be done on the Computer Club website.
The description should provide a concise summary of the change (in present tense). It should be no longer than 50 characters and avoid unnecessary punctuation.
- Example:
fix: resolve issue with navbar not collapsing
The body can provide additional context or details about the change. It should be used to explain what and why the change was made (avoid explaining how, since the code itself should be self-explanatory). Each line in the body should be wrapped to 72 characters.
- Example:
feat(auth): implement token-based authentication Implemented token-based authentication to improve security. This will allow users to stay logged in longer without re-entering credentials.
The footer is useful for linking related issues or breaking changes. If the commit introduces a breaking change, it should be mentioned here with BREAKING CHANGE:
.
Breaking change is a modification that causes the existing functionality to no longer work as expected, potentially requiring users to update their code. It may alter APIs, change dependencies, or remove previously supported features. Always include the
BREAKING CHANGE:
tag in the commit message to alert others when such a change is made.
- Example:
BREAKING CHANGE: The `auth` module now requires the token field for login requests.
If a commit introduces a breaking change, you can also append a "!" to the type before the colon to indicate this directly in the message. This provides an immediate visual cue that the change may require further attention.
Example:
feat!(auth): change authentication flow
feat: add user profile page
feat(auth): implement user authentication
feat(auth): implement user authentication
BREAKING CHANGE: The login endpoint has changed from `/api/v1/login` to `/api/v2/auth/login`. Update your API calls accordingly.
When preparing for a release, use the following convention for the commit message:
- Example:
release: 1.0.0
This indicates that the repository is preparing for a new release, and the version number should follow semantic versioning.
- Use clear, concise descriptions.
- Types should reflect the purpose of the commit.
- Scopes are optional but useful for providing context.
- Keep the short description under 50 characters.
- Use the body and footer when necessary for additional details or breaking changes.
This convention will help maintain a clean and readable commit history for the KEC Computer Club website project.