Collaboration Workflow with Semantic Versioning and Conventions
Steps for Collaborators
Clone the Repository
Download the project to your local machine:bashgit clone <git-repo>Sync with the Latest Code
Ensure your local repository is up-to-date:bashgit pull origin mainCreate a New Branch
Use a semantic branch naming convention:bashgit checkout -b <branch type>/<scope>/<short-description>Branch Types:
feature/→ New features.bugfix/→ Fixing bugs.hotfix/→ Urgent fixes.chore/→ Maintenance tasks.docs/→ Documentation updates.test/→ Testing-related updates.
Scope:
Use a keyword describing the area of change, e.g.,auth,ui,backend.Short Description:
A brief description of the work, e.g.,login-page,fix-header.
Example Branch Name:
feature/auth/login-pagebugfix/ui/header-alignment
Update the Codebase
Make your changes, add files, and commit them using semantic commit messages:bashgit add . git commit -m "<type>(<scope>): <short description>"Commit Message Structure:
<type>(<scope>): <short description>Types:
feat→ New feature.fix→ Bug fix.docs→ Documentation changes.style→ Code style changes (e.g., formatting).refactor→ Code refactoring.test→ Adding or updating tests.chore→ Maintenance tasks.
Example Commit Messages:
feat(auth): add login functionalityfix(ui): resolve header alignment issue
Push Your Branch to Remote
Save your changes to the remote repository:bashgit push origin <branch type>/<scope>/<short-description>Create a Pull Request
- Go to the repository on GitHub/GitLab/Bitbucket.
- Open a Pull Request to merge your branch into the main branch.
- Follow the semantic versioning guidelines for PR titles and add a clear description of your changes.
Versioning (Semantic Versioning)
Use Semantic Versioning (MAJOR.MINOR.PATCH) to manage releases:
- MAJOR: Breaking changes (e.g., incompatible API updates).
- MINOR: New features that are backward-compatible.
- PATCH: Bug fixes or minor improvements.
Examples:
v1.0.0→ Initial release.v1.1.0→ Added new feature.v1.1.1→ Fixed a bug.
Steps for Maintainers
Manage the Pull Request
- Review changes for semantic conventions in branch names and commits.
- Approve and merge if the changes follow conventions.
Tag the Release (Optional)
Create a version tag after merging:bashgit tag -a v<version> -m "Release v<version>" git push origin v<version>Delete the Branch (Optional)
Once the pull request is merged:bashgit branch -D <branch type>/<scope>/<short-description> git push origin --delete <branch type>/<scope>/<short-description>
Workflow Summary
Branch Naming Convention:
<branch type>/<scope>/<short-description>- Example:
feature/auth/login-page
- Example:
Commit Convention:
<type>(<scope>): <short description>- Example:
fix(ui): resolve header alignment issue
- Example:
Versioning:
MAJOR.MINOR.PATCH- Example:
v1.2.0
- Example:
Tagging Releases:
Tag releases to maintain version history:bashgit tag -a v1.2.0 -m "Release v1.2.0" git push origin v1.2.0
Following these conventions ensures a clean and scalable workflow.