Git Workflow (GitHub Flow)
We use a simplified, trunk-based development model known as GitHub Flow. This workflow is fast, simple, and well-suited for our use of continuous deployment with OpenNext and Cloudflare.
The core principle is that the main branch should always be deployable.
Key Branches
main: This is the primary branch. It represents the latest stable, production-ready code. Direct commits tomainare not allowed.- Feature Branches: All new work, whether it’s a feature, a bug fix, or a chore, must be done on a dedicated feature branch.
The Workflow
Step 1: Create a Feature Branch
Before starting any new work, create a new branch from the main branch.
- Branch Naming: Branch names should be descriptive and include the task management ticket number (if applicable). Use the format
[type]/[ticket-number]/[short-description].feat/TICKET-123/add-user-loginfix/TICKET-124/correct-calculation-errorchore/TICKET-125/update-dependencies
# Make sure your main branch is up-to-date
git checkout main
git pull origin main
# Create your new branch
git checkout -b feat/TICKET-123/add-user-loginStep 2: Add Commits
- Make your code changes on the feature branch.
- Create small, logical commits.
- Write clear and descriptive commit messages. We follow the Conventional Commits specification.
feat: Add user login formfix: Prevent form submission on enterdocs: Update README with setup instructions
git add .
git commit -m "feat: Implement user profile page"
git push -u origin feat/TICKET-123/add-user-loginStep 3: Open a Pull Request (PR)
- When your work is complete (or ready for feedback), open a Pull Request to merge your feature branch into
main. - PR Title: The title should be clear and concise.
- PR Description:
- Provide a summary of the changes.
- Link to the relevant task in the task management tool.
- Include screenshots or GIFs for any UI changes.
- Explain how to test the changes.
- Assign at least one reviewer.
Step 4: Code Review
- The assigned reviewer will review the code for correctness, style, and best practices, following our Code Review Process.
- The reviewer can leave comments and request changes.
- The original author makes the requested changes and pushes them to the feature branch.
- The review process continues until the PR is approved.
Step 5: Merge the Pull Request
- Once the PR is approved and all automated checks (CI) have passed, the PR can be merged into
main. - Use “Squash and Merge”: We use this option to keep our
mainbranch history clean and readable. This combines all of the feature branch’s commits into a single commit onmain. - After merging, you can delete the feature branch.
Step 6: Deployment
- Merging to
mainautomatically triggers a deployment to production via our CI/CD pipeline connected to Cloudflare.
Hotfixes
For urgent bugs in production, the process is the same. Create a branch fix/TICKET-xyz/urgent-fix, get it reviewed quickly, and merge it to main.