Version Control
Our projects utilize Git, primarily with repositories hosted on GitHub. With a small team and most projects involving fewer than three collaborators, these guidelines ensure smooth and efficient version control practices.
Repo Naming Conventions
Site Repositories
- Naming Rule: Use the main naked domain name as the repository name, lowercased.
- Examples:
- Bad:
https://www.msml.nl,www.msml.nl,Msml.nl
- Good:
msml.nl
Subdomain Sites
- Naming Rule: Include the subdomain in the repository name.
- Examples:
- Bad:
msml.nl-guidelines
- Good:
guidelines.msml.nl
Non-Site Repositories
- Naming Rule: Use kebab-case for repository names.
- Examples:
- Bad:
LaravelBackup,Spoon
- Good:
laravel-backup,spoon
Branches
Key Principle
- The
release/vx.x.xbranches must always be stable and safe to deploy to production. - Regularly clean up stale branches. For most repositories, the branch does get deleted automatically after merging.
Branch Naming Conventions
The naming conventions for branches are quite similar; however, the prefix depends on the issue type:
-
Story
- Format:
feature/{ticketNumber}-kebab-case-description - Purpose: For implementing features as part of a sprint.
- Example:
feature/MSML-123-add-login-page
- Format:
-
Service Request
- Format:
service/{ticketNumber}-kebab-case-description - Purpose: For handling service requests from the support board.
- Example:
service/MSMLS-456-update-footer-links
- Format:
-
Bug
- Format:
hotfix/{ticketNumber}-kebab-case-description - Purpose: For handling bugs from the support board.
- Example:
hotfix/MSMLS-789-fix-header-crash
- Format:
-
Maintenance / Security / Access
- Format:
- If the issue is part of a sprint, follow the
Storyconvention. - If the issue is on the support board, follow the
Service Requestconvention.
- If the issue is part of a sprint, follow the
- Purpose:
- For framework upgrades, or other maintenance part of the service level agreement.
- For security incidents requiring code changes.
- For giving access by code changes, i.e. adding a user to a seeder.
- Example:
service/MSMLS-999-laravel-12-upgrade/feature/MSML-999-laravel-12-upgradeservice/MSMLS-999-fix-possible-exploit/feature/MSML-999-fix-injection-exploitservice/MSMLS-999-add-john-to-seeder/feature/MSML-999-add-john-to-seeder
- Format:
Following these conventions automatically means it is not possible to create a pull request without a corresponding ticket. When a pull request is created from a branch that does not follow (the correct) naming conventions, it will be rejected.
Workflow for Branches
The workflow for branches depends on the issue type:
Story
- Create a branch from the
masterbranch. - Make changes related to the task.
- Push the branch to the remote repository.
- Create a pull request to merge the branch into
master. - Reviewers validate the changes and approve the pull request.
Service Request
- Create a branch from the latest
release/vx.x.xbranch. - Make changes related to the task.
- Push the branch to the remote repository.
- Create a draft pull request to merge the branch into the latest
release/vx.x.xbranch. - Create a pull request to merge the branch into
master - Reviewers validate the changes to
masterand approve the pull request.
Bug
- Create a branch from the latest
release/vx.x.xbranch. - Make changes related to the task.
- Push the branch to the remote repository.
- Create a pull request to merge the branch into the latest
release/vx.x.xbranch. - Reviewers validate the changes and approve the pull request.
- Do a backmerge by creating a branch or a pull request from
release/vx.x.xbranch to the master branch.
Maintenance / Security / Access
- If the issue is part of a sprint, follow the
Storyworkflow. - If the issue is on the support board, follow the
Service Requestworkflow.
Make sure to never merge the master branch back into the release branch!
Release Branches
Purpose
- Manage production deployments.
Naming Convention
- Format:
release/v{major}.{minor}.x - Example:
release/v3.23.x
Workflow
-
Creating a Pull Request
- From hotfix/service branch to release branch.
- Reviewers:
- One senior developer.
- One medior developer from the project team.
-
Merging and Tagging
- Merge pull request.
- Create a GitHub tag (e.g.,
v1.0.1,v1.0.2) to trigger production deployment.
Pull Requests
Purpose
- Enable peer reviews.
- Validate merge readiness and commit squashing.
- Serve as future reference points in project history.
Requirements
- Mandatory for all changes.
- Reviewed by at least one medior developer and one additional reviewer.
Pull Request Tips:
- Format:
{ticketNumber} A readable and concise description - Example:
MSML-456 Update cart functionality - Ensure all CI checks pass.
- Review it yourself.
- Tag relevant team members for review.
Merging and Rebasing
Guidelines
-
Regular Rebasing
- Rebase your branch regularly to reduce merge conflicts.
- Example:
git rebase master
-
Merging a Feature Branch
- Use:
git merge <branch> --squash - Example:
git checkout master
git merge feature/MSML-123-add-login-page --squash
- Use:
-
Rebasing on Push Denial
- Use:
git rebase - Example:
git fetch origin
git rebase origin/master
- Use:
Commits
Guidelines
- Use descriptive commit messages.
- Include the ticket number in the commit message.
- Write commit messages in present tense.
Good Examples:
MSML-392 Fix cart count on homeMSML-123 Add user profile pageMSMLS-456 Resolve crash on login
Bad Examples:
Fixed issueUpdateMiscellaneous changes