Git_Workflow_for_FAANG
Git Workflow for FAANG
Enterprise-level Git practices at scale.
π FAANG Workflow
graph LR
A[Trunk/Main] --> B[Short-lived Branch]
B --> C[Code Review]
C --> D[Automated Tests]
D --> E[Merge to Trunk]
E --> F[Feature Flags]
F --> G[Gradual Rollout]
π Trunk-Based Development
Work on Short Branches
git checkout main
Start from main.
git pull --rebase origin main
Get latest with rebase.
git checkout -b user/feature-name
Short-lived branch (< 2 days).
Small Commits
git commit -am "Small incremental change"
Many small commits, not one big one.
Merge Same Day
git checkout main
Switch to main.
git merge --no-ff user/feature-name
Merge quickly.
π Feature Flags
Code Behind Flag
if (featureFlags.newLogin) {
// New implementation
} else {
// Old implementation
}
Deploy dark code with flags.
π Commit Message Standards
Format
[JIRA-123] type: Short description
Longer explanation if needed.
- Bullet points work too
- Be specific
Test Plan:
- How was this tested?
Reviewers: @teammate
π Code Review Standards
Before Submitting
git diff main...HEAD
Self-review changes.
npm test
Run all tests locally.
npm run lint
Ensure lint passes.
Small PRs
Keep PRs under 400 lines for faster review.
π Security Practices
Never Commit Secrets
git secrets --scan
Scan for secrets before commit.
Use .gitignore
.env
*.pem
credentials.json
Ignore sensitive files.
β‘ Performance at Scale
Shallow Clone
git clone --depth 50 repo.git
Faster clone for CI.
Sparse Checkout
git sparse-checkout init
Work on subset of repo.
git sparse-checkout set src/my-service
Only checkout what you need.
Git LFS
git lfs install
For large files.
git lfs track "*.psd"
Track large file types.
π Monitoring & Metrics
Track:
- Time to merge
- PR size
- Review turnaround
- CI pass rate
π‘ Tips
Never Rebase Public
Once pushed to main, never rebase.
CI Before Review
All tests must pass before requesting review.
π Related
#git #faang #enterprise #workflow