se agrega el manual de branches para git
This commit is contained in:
1 parent
7d55f90dc3
commit
f915802fb4
2 files changed
+196
-3
No files matched your search
Vendored
+4
-3
@@ -13,12 +13,12 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "005-Learn/Instructivo Git Gitea.md",
|
||||
"file": "005-Learn/Instructivo Git Branches.md",
|
||||
"mode": "preview",
|
||||
"source": true
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "Instructivo Git Gitea"
|
||||
"title": "Instructivo Git Branches"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -185,9 +185,10 @@
|
||||
},
|
||||
"active": "52972da0bc9d4ad0",
|
||||
"lastOpenFiles": [
|
||||
"005-Learn/Instructivo Git Gitea.md",
|
||||
"005-Learn/Instructivo Git Branches.md",
|
||||
"005-Learn/Obsidian WorkingCopy Manual.md",
|
||||
"005-Learn/Proyecto SAP B1 - FastAPI - React - Next.js.md",
|
||||
"005-Learn/Instructivo Git Gitea.md",
|
||||
"005-Learn/Roadmap Next.js.md",
|
||||
"005-Learn/Stack Tecnológico Recomendado.md",
|
||||
"005-Learn/roadmap_nextjs_erp.html",
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
# 🌿 Guía Completa para Crear y Manejar un Branch en Git
|
||||
|
||||
Porque romper `main` directamente es una tradición demasiado popular en desarrollo de software.
|
||||
Git existe precisamente para evitar ese tipo de tragedias humanas.
|
||||
|
||||
---
|
||||
|
||||
# 1️⃣ Verifica el estado actual del proyecto
|
||||
|
||||
```bash
|
||||
git status
|
||||
```
|
||||
|
||||
Esto te mostrará:
|
||||
|
||||
- Archivos modificados
|
||||
- Archivos en stage
|
||||
- Archivos sin seguimiento
|
||||
|
||||
---
|
||||
|
||||
# 2️⃣ Guarda tus cambios importantes
|
||||
|
||||
Si tienes cambios importantes, crea un commit antes de crear el branch.
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Version estable antes de nueva funcionalidad"
|
||||
```
|
||||
|
||||
✅ Esto crea un punto seguro al cual regresar.
|
||||
|
||||
---
|
||||
|
||||
## 📦 Alternativa: usar stash
|
||||
|
||||
Si todavía no quieres hacer commit:
|
||||
|
||||
```bash
|
||||
git stash
|
||||
```
|
||||
|
||||
Luego podrás recuperarlos con:
|
||||
|
||||
```bash
|
||||
git stash pop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 3️⃣ Ve a la rama principal
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 4️⃣ Descarga lo último del repositorio
|
||||
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
Esto sincroniza tu proyecto local con el remoto.
|
||||
|
||||
---
|
||||
|
||||
# 5️⃣ Crea la nueva rama
|
||||
|
||||
```bash
|
||||
git checkout -b nueva-funcionalidad
|
||||
```
|
||||
|
||||
## 📌 Ejemplo real
|
||||
|
||||
```bash
|
||||
git checkout -b agregar-dashboard-powerbi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 6️⃣ Verifica que estás en la nueva rama
|
||||
|
||||
```bash
|
||||
git branch
|
||||
```
|
||||
|
||||
La rama actual aparecerá con un `*`
|
||||
|
||||
## 📌 Ejemplo
|
||||
|
||||
```text
|
||||
main
|
||||
* agregar-dashboard-powerbi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 7️⃣ Trabaja normalmente y guarda cambios
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Agrega nueva funcionalidad"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 8️⃣ Regresa a main cuando todo funcione
|
||||
|
||||
```bash
|
||||
git checkout main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 9️⃣ Une la nueva funcionalidad a main
|
||||
|
||||
```bash
|
||||
git merge nueva-funcionalidad
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 🔟 Sube los cambios al repositorio remoto
|
||||
|
||||
```bash
|
||||
git push
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 1️⃣1️⃣ Elimina la rama si ya no la necesitas
|
||||
|
||||
```bash
|
||||
git branch -d nueva-funcionalidad
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 🧠 Recomendaciones importantes
|
||||
|
||||
✅ Nunca trabajes directamente sobre `main`
|
||||
✅ Haz commits pequeños y claros
|
||||
✅ Usa nombres descriptivos para tus branches
|
||||
✅ Verifica siempre con `git status`
|
||||
|
||||
---
|
||||
|
||||
# 🚨 Comandos útiles extra
|
||||
|
||||
## Ver historial de commits
|
||||
|
||||
```bash
|
||||
git log --oneline
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ver diferencias de archivos
|
||||
|
||||
```bash
|
||||
git diff
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Salir del visor de git diff
|
||||
|
||||
Presiona:
|
||||
|
||||
```text
|
||||
q
|
||||
```
|
||||
|
||||
Porque claramente mostrar texto simple en terminal era demasiado fácil para Unix.
|
||||
|
||||
---
|
||||
|
||||
# 🎯 Resultado esperado
|
||||
|
||||
Tu flujo ideal debería verse así:
|
||||
|
||||
```text
|
||||
main
|
||||
└── nueva-funcionalidad
|
||||
└── commits
|
||||
└── merge a main
|
||||
```
|
||||
|
||||
Un proceso ordenado.
|
||||
Casi sospechosamente profesional para estándares normales de desarrollo.
|
||||
Reference in new issue
Block a user