🌳Estructura de Branches
📋 Roles de Branches:
- 🟢 main: Producción (auto-tag, auto-deploy)
- 🟡 develop: Staging para major versions
- 🔵 feature/*: Desarrollo temporal
- 🔴 hotfix/*: Fixes críticos
🚦Árbol de Decisión
🤔 ¿Qué tipo de cambio es?
⚡Flujo para Cambios Menores
Feature Branch desde Main
Para bugs y features pequeñas
git pull origin main
git checkout -b fix/email-validation
Desarrollo + PR
Con linter y tests automáticos
git push -u origin fix/email-validation
# Create PR → Review → Merge
Auto-Release
Tag y deploy automáticos
# Auto-tag: v1.2.3
# Auto-build: Docker image
# Auto-deploy: Production
🧪Flujo para Major Versions
Desarrollo inicial: Funcionalidad básica implementada, muchos bugs esperados
git checkout -b feature/new-auth-system
# ... desarrollo ...
git checkout develop
git merge feature/new-auth-system
git tag v2.0.0-alpha.1
git push origin v2.0.0-alpha.1
Feature complete: Funcionalidad completa, testing intensivo
git tag v2.0.0-beta.1
git push origin v2.0.0-beta.1
# → Deploy a staging environment
Release candidate: Listo para producción, último testing
git push origin v2.0.0-rc.1
# → Final testing, user acceptance
Release final: Merge a main, auto-deploy
git merge develop
git push origin main
# → Auto-tag v2.0.0 → Production deploy
⏰Cuándo Hacer Pre-releases
📅 Guía de Timing
Pre-release | Cuándo | Duración | Criterio |
---|---|---|---|
Alpha | Feature 70% completa | 1-2 semanas | Core funciona, puede tener bugs |
Beta | Feature 90% completa | 2-3 semanas | Testing intensivo, feedback users |
RC | Feature 99% completa | 1 semana | Solo bugs críticos, no features |
Stable | Todo perfecto | Release | Cero bugs conocidos |
📋Ejemplos Prácticos
Fix validación de email
git commit -m "fix: validar formato email correctamente"
git push -u origin fix/email-validation
# PR → Merge → Auto-tag v1.2.4
Nuevo sistema de autenticación
git checkout develop
git checkout -b feature/oauth-system
# Serie de pre-releases
git tag v2.0.0-alpha.1 # OAuth básico
git tag v2.0.0-alpha.2 # Google/GitHub
git tag v2.0.0-beta.1 # UI completa
git tag v2.0.0-rc.1 # Testing final
# Release final
git checkout main && git merge develop
# → Auto-tag v2.0.0
Vulnerability crítica
⚙️CI/CD Configuration
✅ Setup Recomendado
- Branch protection en main y develop
- Require PR reviews para main
- Auto-delete feature branches
- Status checks obligatorios
- Auto-merge cuando checks pasan
- Staging environment para develop
- Production environment para main
🎯Comandos Esenciales
git checkout -b develop
git push -u origin develop
# Cambio menor (directo main)
git checkout main
git checkout -b fix/pequeño-bug
# ... PR → merge
# Feature grande (develop first)
git checkout develop
git checkout -b feature/gran-cambio
# ... merge to develop → pre-releases
# Pre-release manual
git checkout develop
git tag v2.0.0-alpha.1
git push origin v2.0.0-alpha.1
# Release final
git checkout main
git merge develop
git push origin main # → auto-tag
Hotfix urgente git checkout main git checkout -b hotfix/critico # ... fix → PR → fast merge # Cleanup local git checkout main git pull origin main git branch -d feature/nombre-branch
📊Cuándo Usar Cada Estrategia
🎯 Guía de Decisión Rápida
🎬Scenarios Reales
📱 Proyecto: App de E-commerce
Fix: Error en cálculo de impuestos
Impacto: Bug menor, funcionalidad trabaja pero mal cálculo
Estrategia: Feature branch → Main directo
Feature: Sistema de reviews y ratings
Impacto: Nueva funcionalidad grande, cambios en DB
Estrategia: Develop → Pre-releases → Main
Hotfix: Falla de pagos con Stripe
Impacto: Crítico - usuarios no pueden pagar
Estrategia: Hotfix directo a main
📈Métricas y KPIs
📊 Para Indie Serio
Métrica | Target | ¿Por qué importa? |
---|---|---|
Deploy Frequency | 2-3x por semana | Mantener momentum |
Lead Time | < 2 días para minor | Feedback rápido |
Pre-release Duration | 4-6 semanas max | No bloquear progress |
Hotfix Time | < 2 horas | Crítico para usuarios |
Failed Deployments | < 5% | Confianza en proceso |
🎯 Objetivos como Indie Serio
- Mantener velocity sin sacrificar calidad
- Users nunca esperan más de 1 semana por fixes
- Pre-releases permiten validar antes de release
- Main branch siempre deployable
- Proceso predecible y documentado
- Automatización reduce trabajo manual
- Feedback loop rápido con usuarios
🛠️Herramientas Recomendadas
🔧 Stack Recomendado:
- 📦 Semantic Release: Auto-versioning basado en commits
- 🎣 Husky: Pre-commit hooks para linting
- 📝 Conventional Commits: Formato estándar de commits
- 🏷️ Auto-tag Action: Tags automáticos en GitHub
- 🐳 Docker: Containerización consistente
- 📊 GitHub Actions: CI/CD integrado
- 🔍 SonarCloud: Code quality analysis