Advanced Git for Team Workflows
GitFlow Strategy
GitFlow is a structured branching model for managing releases.
Main branches:
-
main→ Production-ready code -
develop→ Integration branch
Supporting branches:
-
feature/* -
release/* -
hotfix/*
Popularized by Vincent Driessen.
GitFlow Lifecycle
-
Create feature branch from develop
-
Merge feature → develop
-
Create release branch
-
Merge release → main
-
Hotfix branches for urgent production issues
Example
git checkout developgit checkout -b feature/payment-api
After development:
git checkout developgit merge feature/payment-api
Pull Request (PR) Strategy
Modern teams use PR-based workflow via platforms like:
-
GitHub
-
GitLab
PR Best Practices
1. Small PRs
Easier review and faster approval.
2. Descriptive Title
Example:
Add JWT authentication middleware
3. Code Review Checklist
-
Clean code?
-
Tests added?
-
No secrets committed?
-
Documentation updated?
4. Require Approvals
At least 1–2 reviewers before merge.
Trunk-Based Development (Alternative to GitFlow)
-
Single main branch
-
Short-lived feature branches
-
Frequent merges
Used by companies practicing CI/CD heavily.
Comments
Post a Comment