--- name: git-branch description: Crea una rama de trabajo (issue/* o quick/*). Nunca trabajar directamente en master. argument-hint: disable-model-invocation: true user-invocable: true allowed-tools: Bash, Read --- # git-branch Crea una rama de trabajo siguiendo trunk-based development. **Nunca trabajar directamente en master.** ## Sintaxis ```bash /git-branch issue /git-branch quick ``` ## Ejemplos ```bash /git-branch issue 0013 hot-reload # Crea issue/0013-hot-reload /git-branch quick fix-typo-readme # Crea quick/fix-typo-readme ``` ## Precondiciones - [ ] Repositorio git válido - [ ] Branch master existe - [ ] Working tree limpio (sin cambios pendientes) ## Flujo ### 1. Verificar estado del repositorio ```bash git branch --show-current git status --short ``` **Si no estamos en master:** `git checkout master` **Si hay cambios sin commitear:** STOP y avisar al usuario: ``` Hay cambios sin commitear. Opciones: 1. Commitear: git add . && git commit -m "mensaje" 2. Stash: git stash 3. Descartar: git reset --hard (peligroso) ``` ### 2. Actualizar master desde remoto ```bash git pull --rebase ``` ### 3. Crear rama según tipo **Para issues:** ```bash git checkout -b issue/- ``` **Para cambios rápidos:** ```bash git checkout -b quick/ ``` ### 4. Confirmar creación ```bash git branch --show-current ``` Informar: ``` Rama `` creada desde master actualizado Cuando termines: /git-push ``` ## Convenciones - **Formato issue**: `issue/-` (4 dígitos) - **Formato quick**: `quick/` - **Ramas cortas**: horas, no días - **No pushear ramas**: integrar via merge a master - **No underscores**: solo guiones ## Reglas - NUNCA trabajar directamente en master - SIEMPRE verificar working tree limpio - SIEMPRE actualizar master antes de crear rama