-
Notifications
You must be signed in to change notification settings - Fork 4
Git Workflow and Branching
AlexZorkin edited this page May 13, 2025
·
1 revision
This document outlines the Git workflow and branching strategy used for the LCFS project. Adherence to this strategy ensures a clean commit history, facilitates collaboration, and supports an organized release process. This is part of the requirements for ticket #2410.
-
Main Branch is Production-Ready: The
mainbranch should always reflect a stable, production-ready state of the application. - Feature Branches: All new development (features, bug fixes, enhancements) must happen in separate feature branches.
-
Pull Requests (PRs): Changes are integrated into the
mainbranch (or a release/develop branch if used) via Pull Requests, which require review and passing automated checks. - Regular Integration: Integrate feature branches frequently to avoid large, complex merges.
The project generally follows GitHub Flow or a similar simple feature-branch workflow.
- Represents the latest stable, released version of the application.
- Direct commits to
mainare strictly prohibited. Changes are merged via PRs only. - Tags are created from
mainto mark release points (e.g.,v1.0.0,v1.1.0).
-
Creation: When starting work on a new feature, bug fix, or enhancement, create a new branch from the latest
mainbranch.git checkout main git pull origin main git checkout -b feature/your-descriptive-name # e.g., feature/add-user-profile, bugfix/login-error-123 -
Naming Convention: Use a prefix like
feature/,bugfix/,hotfix/,docs/,chore/followed by a short, descriptive name. Reference issue numbers if applicable (e.g.,feature/123-new-reporting-module). - Scope: Keep feature branches focused on a single, distinct piece of work.
- Push Regularly: Push your feature branch to the remote repository frequently to back up your work and allow for visibility.
- For more complex projects or larger teams, a
developorintegrationbranch might be used. Feature branches would be merged intodevelopfirst, and thendevelopwould be merged intomainfor releases. -
Action: Clarify if a persistent
developbranch is currently in use for LCFS. If not, the default is feature branches directly tomainvia PRs.
- For managing releases,
release/branches (e.g.,release/v1.1.0) can be created frommain(ordevelop). Only bug fixes related to the release are merged into a release branch. - Action: Clarify if formal release branches are used.
- If a critical bug is found in production (
main), ahotfix/branch should be created directly frommain.git checkout main git pull origin main git checkout -b hotfix/critical-issue-description
- Once the hotfix is complete and tested, it is merged back into
mainvia a PR and also merged into any activedevelopor release branches. - A new tag should be created on
mainfor the hotfix release.
-
Create PR: Once a feature branch is ready, create a Pull Request targeting the
mainbranch (ordevelopif applicable). - Description: Provide a clear description of the changes, the problem it solves, and link to any relevant issues.
- Automated Checks: Ensure all CI/CD checks (linters, tests, builds) pass.
- Code Review: At least one (or as per team policy) team member must review and approve the PR. See Code Review Process.
- Address Feedback: Make any necessary changes based on review feedback.
-
Merge: Once approved and all checks pass, the PR can be merged.
-
Merge Strategy: Prefer squash and merge or rebase and merge to keep the
mainbranch history clean and linear. Avoid direct merge commits if possible, unless the feature branch history is intentionally preserved. - Action: Confirm the preferred merge strategy for the team.
-
Merge Strategy: Prefer squash and merge or rebase and merge to keep the
- Delete Feature Branch: After merging, delete the feature branch from both local and remote repositories.
Refer to the Contribution Guidelines for commit message standards.
- Git: Distributed version control system.
- GitHub: Platform for hosting the repository, managing issues, and conducting Pull Requests/code reviews.
This workflow aims to maintain a high-quality, stable codebase. Team members should familiarize themselves with these practices.