Git & PR Strategy
📌 Preface
This page outlines a set of best practices for Git workflow and pull request (PR) management.
The goal is to keep all projects structured, consistent, and understandable for every team member.
Following company-wide routines and procedures ensures efficiency and clarity across all projects.
🚀 Objective
Provide an elegantly structured, standardized workflow that combines:
- Git Flow for structured branching
- GitHub Flow for lightweight PR-driven collaboration
- Conventional Commits for clear, semantic commit messages
🧠 Git Flow Overview
Git Flow is a branching model with a clear structure for collaboration:
- Master/Main: Production-ready code.
- Develop: Integration branch for feature development.
Feature Branches:
- Created from
develop. - Used to implement new features.
- Merged back into
developwhen complete.
Release Branches:
- Created from
developwhen preparing a release. - Allow final bug fixes and version updates.
- Merged into both
masteranddevelopafter release.
Hotfix Branches:
- Created from
masterto fix critical production issues. - Merged into both
masteranddevelop.
🕒 GitHub Flow Overview
GitHub Flow focuses on pull requests for lightweight, branch-based collaboration:
- Branch: Create a branch for each new feature or bug fix.
- Commit: Make small, focused commits with clear messages.
- Pull Request: Open a PR to propose changes and initiate code review.
- Discuss & Review: Collaborate via discussion and code reviews.
- Deploy: Merge approved PRs into
mainfor deployment.
🎯 Conventional Commits
Standardized commit messages improve clarity and traceability.
Format:
Elements:
- Type: Purpose of the commit (
feat,fix,chore, etc.) - Scope: Module or component affected
- Description: Short, imperative statement in present tense
Example:
feat(user-auth): add registration endpoint
🛠️ Combined Strategy
Integrate Git Flow, GitHub Flow, and Conventional Commits:
1. Overview
- Master/Main: Production-ready code
- Release: Integration branch for features
2. Feature Development
- Create branches from the latest release branch under
release/. - Use Conventional Commits for all changes.
- Merge feature into the latest release branch when complete.
3. Release Preparation
- Create a release branch from
develop. - Apply Conventional Commits for release updates.
- Merge into
masterupon completion.
4. Hotfixes
- Create hotfix branches from
master. - Use Conventional Commits for all hotfix changes.
- Merge into both
masterand latest release branch.
5. Pull Requests
- PRs must follow Conventional Commits.
- Review, discuss, and validate changes before merging.
- Enforce branch protection for consistency.
📊 Branch Naming Conventions
Prefix Branches:
feature/– new featuresbugfix/– bug fixeshotfix/– critical fixes
Pattern:
/ISSUE-ID_topic-name
Example:
feature/DEV-1492_Outlet-module-settings bugfix/DEV-1492_Outlet-module-settings hotfix/DEV-1492_Outlet-module-settings
Guidelines:
- Use
-between letters and numbers for clarity (DEV-1492) - Use
_to separate identifier and topic - Use
-between words in the topic name (Outlet-module-settings) - Keep names readable and consistent for reviewers
📎 Demo Use Case
Assume issue DEV-1492 is assigned:
- Create Branch:
feature/DEV-1492_Outlet-module-settings
- Development:
- Follow Conventional Commits for all commits
- Keep commits small and descriptive
- Pull Request:
- Name PR according to the same pattern
- Ensure it’s easy to find and review among open PRs
This approach ensures consistency, readability, and smooth collaboration across the team.