v1.31.0
workflowgit-syncreferences/

procedimiento.md

Referencia que git-sync carga bajo demanda desde su SKILL.md.

git-syncskill
referencescarpeta
11.582 Btamaño
2026-09-08último cambio del pack

Se lee bajo demanda al invocar la skill. Vive aparte para no pasar del techo de 400 lineas del SKILL.md.


USE FOR: sincronizar el repo con el REMOTO git (pull + push, según branching.estrategia). DO NOT USE FOR: actualizar la documentación _hilo/ con el estado del código → usar /hv:sync. Sincronizar con el Hub → /hub-client.

Skill ref Skill: git-best-practices — Skill ref detail


1. Flujo Git

2.1 1. Verificar Estado Local

# Verificar si hay cambios sin commitear
git status --porcelain

If uncommitted changes:

⚠️ CAMBIOS SIN COMMITEAR

Tienes cambios locales no commiteados. ¿Qué deseas hacer?

1. Hacer commit primero (/commit)
2. Guardar en stash y continuar
3. Cancelar

Opción (1/2/3):

2.2 Pre merge checklist

🔍 Pre merge intro → See skill: git-best-practices/checklists/pre-merge.md

Pre merge auto checks:

VerificacionComandoBloqueante
Check builddotnet build --no-restore -q✅
Check testsdotnet test --no-build -q⚠️ If configured
Check secretsPattern scan✅
Check conflict markersgrep -r "<<<<<<" src/✅
🔍 PRE-MERGE CHECKLIST
━━━━━━━━━━━━━━━━━━━━━━

  ✅ Check build
  ✅ Check secrets
  ✅ Check conflict markers
  ⬜ Check tests (Skipped no config)

All checks passed

2.3 Merge strategy

Merge strategy intro → See skill: git-best-practices/strategies/merge-strategies.md

⚠️ Adaptable a estrategia: Claude lee la estrategia de branching de ESTADO_PROYECTO.json para adaptar el comportamiento de merge → _hilo/ESTADO_PROYECTO.json → configuracion.branching.estrategia

Estrategia por defecto: github-flow (PRs + squash)
Branch typeEstrategiaRazon
feature/* → Actualizargit pull --rebaseRebase reason
feature/* → main (PR)Squash mergeSquash reason
hotfix/* → mainMerge commitHotfix reason
release/* → mainMerge commitRelease reason
Estrategia simplificada: github-flow-simplificado (desarrollador individual, sin PRs)
Branch typeEstrategiaRazon
feature/* → Actualizargit pull --rebaseRebase reason
feature/* → main (merge local)git merge --no-ffPreserva commits individuales, revertible limpiamente con git revert -m1
hotfix/* → maingit merge --no-ffHotfix reason
release/* → mainMerge commitRelease reason

💡 github-flow-simplificado: Merge --no-ff en local en lugar de crear PR. Ideal para desarrollador individual.

  • No requiere PR — merge directo en local
  • Preserva commits individuales para mejor git bisect
  • Revertible limpiamente: git revert -m1 <merge-commit>
Estrategia Developer Branch: developer-branch (Rama personal remota con features locales)

Leer nomenclatura de configuracion.branching.convencionRamas: _hilo/ESTADO_PROYECTO.json → configuracion.branching

Branch typeEstrategiaRazon
{ramaBase} → Actualizargit pull origin {ramaBase}Rama base configurable (main, master, dev.{usuario}...)
yyyyMMdd-{tipo}-nnn → {ramaBase}git merge (plain)Flujo: crear rama local → desarrollar → merge a rama base → push

⚠️ Las ramas feature NUNCA se pushean al remoto

  • Push de features deshabilitado
  • Confirmar con usuario antes de merge y push

Flujo: crear rama local → desarrollar → merge a rama base → push:

1. git checkout {ramaBase}              # Posicionarse en rama base
2. git pull origin {ramaBase}           # Actualizar
3. git checkout -b {yyyyMMdd-tipo-nnn}  # Crear rama local (NUNCA pushear)
4. # ... desarrollo + commits ...
5. git checkout {ramaBase}
6. git merge {rama-local}               # ⚠️ CONFIRMAR con usuario
7. git push origin {ramaBase}           # ⚠️ CONFIRMAR con usuario
8. git branch -d {rama-local}           # Limpieza opcional

💡 Nomenclatura configurable: Leer convencionRamas de ESTADO_PROYECTO.json. Si contiene {tipo}, leer tiposTarea para los códigos válidos (DT, HV, BUG...).

2.4 2. Obtener Cambios Remotos

# Fetch para ver si hay cambios
# NOTA: En developer-branch, fetch apunta a {ramaBase} (ej: dev.claudio), no a main
git fetch origin

# Ver diferencias
git log HEAD..origin/$(git branch --show-current) --oneline
📥 CAMBIOS REMOTOS DISPONIBLES

Rama: feature/HV-05
Commits nuevos: 3

  abc1234 - feat: Añadir validación (jperez, hace 2h)
  def5678 - fix: Corregir error (mlopez, hace 1h)
  ghi9012 - docs: Actualizar README (jgarcia, hace 30m)

¿Descargar e integrar? (s/n):

2.5 3. Integrar Cambios (Pull con Rebase)

# Rebase para historial limpio (branch tipo feature/*)
git pull --rebase origin $(git branch --show-current)

If conflicts:

⚠️ CONFLICTOS DETECTADOS

Archivos en conflicto:
  • src/Controllers/ScholarshipsController.cs
  • src/Services/ScholarshipService.cs

Opciones:
1. Resolver manualmente (abre VS Code)
2. Aceptar cambios remotos (theirs)
3. Mantener mis cambios (ours)
4. Abortar rebase

Opción (1/2/3/4):

2.6 4. Subir Cambios Locales (Push)

# Push normal (en developer-branch: solo pushear ramaBase, NUNCA features)
git push origin $(git branch --show-current)

# Después de rebase con conflictos resueltos → force-with-lease (NUNCA --force)
# NOTA: En developer-branch con pushFeatures=false, NUNCA pushear ramas locales
git push --force-with-lease origin $(git branch --show-current)

⚠️ Force with lease Force with lease intro:

  • --force-with-lease: ✅ Force with lease safe
  • --force: ❌ Force dangerous

→ See skill: git-best-practices/strategies/merge-strategies.md

📤 SUBIENDO CAMBIOS

Rama: feature/HV-05
Commits a subir: 2

  xyz1234 - [HV-05] feat(api): Añadir paginación
  xyz5678 - [HV-05] test: Añadir tests de paginación

✅ Push completado

2.7 Post merge restore

🔄 Post merge restore intro

After pull detect:

# Detectar si package-lock.json o *.csproj cambiaron en los commits descargados
git diff HEAD@{1}..HEAD --name-only | grep -E "(\.csproj|packages\.lock\.json|package-lock\.json|yarn\.lock)"

If dependencies changed:

File typeRestore command
*.csproj / packages.lock.jsondotnet restore
package-lock.jsonnpm ci
yarn.lockyarn install --frozen-lockfile
🔄 Dependency changes detected

Changed files:
  • src/MyCompany.MyApp.Web/MyCompany.MyApp.Web.csproj
  • src/MyCompany.MyApp.Infrastructure/MyCompany.MyApp.Infrastructure.csproj

Restoring: dotnet restore...
✅ Restore completed

2.8 5. Confirmación

✅ SINCRONIZACIÓN COMPLETADA

📥 Descargados: 3 commits
📤 Subidos: 2 commits
🔀 Rama: feature/HV-05
🔍 Pre merge checklist: ✅ All passed
🔄 Dependency restore: ✅ dotnet restore
⏱️ Última sincronización: [FECHA_HORA]

Estado: Al día con origin/{0}

2. Resumen de comandos

AcciónGit
Obtener cambiosgit pull --rebase
Subir cambiosgit pushIncluded in checkin
Push after rebasegit push --force-with-leaseN/A
Ver historialgit logtf history
Resolver conflictosgit mergetooltf resolve
Descartar cambiosgit checkout -- .tf undo /recursive
Restore depsdotnet restore / npm cidotnet restore / npm ci

3. Configuracion

Config intro _hilo/ESTADO_PROYECTO.json:

Nivel de integracionComportamiento
basicoConfig basic
medioConfig medium
altoConfig high

4. Casos de error

No connection

❌ Connection error

Verify connection:
  • Check internet
  • Check credentials
  • Check remote url: git remote -v

Branch not published

⚠️ Branch not published title

Branch not published msg: feature/HV-05

Publish branch:
  git push -u origin feature/HV-05

Publish now

Rebase conflict

⚠️ Rebase conflict title

Rebase conflict msg

To continue after resolve:
  git rebase --continue

To abort:
  git rebase --abort

After rebase push:
  git push --force-with-lease origin $(git branch --show-current)

⚠️ Critical reminders

Siempre

  • ✅ Always check uncommitted
  • ✅ Always rebase
  • ✅ Always pre merge checklist (2.2)
  • ✅ Always force with lease (2.6)
  • ✅ Always post merge restore (2.7)
  • ✅ Always show commits
  • ✅ Always offer conflict options

Nunca

  • ❌ git push --force — Never force reason
  • ❌ Never pull without warning
  • ❌ Never auto resolve conflicts
  • ❌ Never skip pre merge

Skill integration

Skill integration intro git-best-practices:

RecursoUso
strategies/merge-strategies.mdSkill merge
strategies/branching-models.mdSkill branching
checklists/pre-merge.mdSkill pre merge
tools/git-hooks-automation.mdSkill hooks
patterns/ssh-signing.mdSkill signing

Execution flow diagram

┌─────────────────┐
│ 1. Detectar VCS  │
└────────┬────────┘
         │
    ┌────┴────┐
    │  Git?   │
    └────┬────┘
    Yes  │  No
         ▼
┌─────────────────┐
│ 2. git status    │ → Cambios? → Commit/Stash/Cancel
└────────┬────────┘
         ▼
┌─────────────────┐
│ 3. Pre-merge     │ → Build + Secrets + Conflict markers
│    CHECKLIST     │
└────────┬────────┘
         ▼
┌─────────────────┐
│ 4. git fetch     │ → Ver commits remotos
└────────┬────────┘
         ▼
┌─────────────────┐
│ 5. Merge strategy│ → Adaptar según tipo de rama
│    (rebase/merge)│
└────────┬────────┘
         ▼
┌─────────────────┐
│ 6. git pull      │ → Conflictos? → Resolver
│    --rebase      │
└────────┬────────┘
         ▼
┌─────────────────┐
│ 7. Post-merge    │ → ¿Cambió .csproj? → dotnet restore
│    RESTORE       │ → ¿Cambió package-lock? → npm ci
└────────┬────────┘
         ▼
┌─────────────────┐
│ 8. git push      │ → Normal o --force-with-lease
│    (según nivel) │
└────────┬────────┘
         ▼
┌─────────────────┐
│ 9. Confirmación  │ → Resumen completo
└─────────────────┘

NOTAS

  • En Git: Pull + Push son operaciones separadas
  • El comando /hv:commit ya maneja ambos VCS
  • Este comando (/hv:git-sync) muestra instrucciones adaptadas al VCS detectado
  • Note pre merge
  • Note restore

← Volver a la ficha de git-sync

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/.claude/skills/git-sync/references/procedimiento.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0