my-notes

Git_Workflow_for_FAANG

1 min read

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.



#git #faang #enterprise #workflow

Built with mdgarden