Quick Reference - Git Workflow

November 7, 2025 ยท View on GitHub

Branching Strategy: Git Flow (dev โ†’ main)


๐Ÿš€ Start New Feature

git checkout dev && git pull origin dev
git checkout -b feat/your-feature-name

๐Ÿ’พ Commit Changes

git add .
git commit -m "feat: your change

Details here.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>"

Commit types: feat, fix, docs, chore, test, ci, perf, style, refactor, revert


๐Ÿ“ค Create PR to dev

git push -u origin feat/your-feature-name
gh pr create --base dev --head feat/your-feature-name \
  --title "feat: your feature" \
  --body "## Summary
Your description here"

โœ… Merge PR

# Via CLI
gh pr merge <PR-NUMBER> --squash --delete-branch

# Via GitHub UI (recommended)
# Click "Squash and merge"
# Branch auto-deletes

๐ŸŽ‰ Release to main

git checkout dev && git pull origin dev
gh pr create --base main --head dev \
  --title "chore(release): v1.2.3" \
  --body "## Release Summary
Changes included..."

# After merge
git checkout main && git pull origin main
git tag -a v1.2.3 -m "Release 1.2.3"
git push origin v1.2.3

๐Ÿ”ฅ Hotfix (Emergency)

git checkout main && git pull origin main
git checkout -b hotfix/critical-fix

# Make fix
git add . && git commit -m "fix: critical issue"

gh pr create --base main --head hotfix/critical-fix \
  --title "[HOTFIX] fix: critical issue"

# After merge to main, backport to dev
git checkout dev && git merge main && git push origin dev

๐Ÿ“‹ Branch Naming

  • feat/ - New features
  • fix/ - Bug fixes
  • docs/ - Documentation
  • chore/ - Maintenance
  • test/ - Tests
  • ci/ - CI/CD changes
  • hotfix/ - Emergency fixes

๐Ÿ›ก๏ธ Branch Protection

main (production)

  • โœ… Require PR
  • โœ… Require checks: CI Quality Gate, Security Audit
  • โœ… Require conversation resolution
  • โŒ No direct pushes

dev (integration)

  • โœ… Require PR
  • โœ… Require checks: CI Quality Gate, Security Audit
  • โœ… Require conversation resolution
  • โš ๏ธ Force push allowed (for cleanup)

๐Ÿ› Troubleshooting

Can't push to dev/main? โ†’ Create PR, protected branches don't allow direct pushes

Checks failing? โ†’ Wait for CI to pass or fix issues

Branch diverged?

git checkout dev && git pull origin dev
git checkout your-branch && git merge dev
git push origin your-branch --force-with-lease

Full Guide: BRANCHING-STRATEGY.md