Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
clase:daw:daw:2eval:tema06 [2021/11/16 20:19] admin [Recetas] |
clase:daw:daw:2eval:tema06 [2025/04/13 10:37] (actual) admin [6. Control de Versiones Avanzado] |
||
---|---|---|---|
Línea 6: | Línea 6: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
Línea 14: | Línea 15: | ||
{{: | {{: | ||
+ | {{: | ||
Ejemplo de Ramas | Ejemplo de Ramas | ||
Línea 50: | Línea 52: | ||
* Crear una rama nueva y subirla | * Crear una rama nueva y subirla | ||
+ | <sxh bash> | ||
git branch nuevaRama | git branch nuevaRama | ||
- | git checkout | + | git switch nuevaRama |
- | git push -u origin nuevaRama | + | git push --set-upstream origin |
+ | git push -u | ||
+ | </ | ||
\\ | \\ | ||
\\ | \\ | ||
* Bajar una nueva rama | * Bajar una nueva rama | ||
+ | <sxh bash> | ||
git fetch --prune | git fetch --prune | ||
- | git checkout | + | git switch |
+ | </ | ||
<note tip> | <note tip> | ||
* '' | * '' | ||
- | * '' | + | * '' |
</ | </ | ||
Línea 71: | Línea 78: | ||
* Borrar una rama en local que ha sido mergeada o subida | * Borrar una rama en local que ha sido mergeada o subida | ||
- | git branch -d miRama | + | <sxh bash> |
git branch --delete miRama | git branch --delete miRama | ||
+ | git branch -d miRama | ||
+ | </ | ||
\\ | \\ | ||
Línea 79: | Línea 88: | ||
* Borrar una rama en local que NO ha sido mergeada ni subida (hay 3 formas distintas). Pero es usar el modificador '' | * Borrar una rama en local que NO ha sido mergeada ni subida (hay 3 formas distintas). Pero es usar el modificador '' | ||
- | git branch -d -f miRama | + | <sxh bash> |
git branch --delete --force miRama | git branch --delete --force miRama | ||
+ | git branch -d -f miRama | ||
git branch -D | git branch -D | ||
+ | </ | ||
Línea 89: | Línea 100: | ||
* Borrar una rama en remoto | * Borrar una rama en remoto | ||
+ | <sxh bash> | ||
git push origin --delete miRama | git push origin --delete miRama | ||
+ | </ | ||
\\ | \\ | ||
Línea 114: | Línea 127: | ||
Se usa para poner los commits de origin/ | Se usa para poner los commits de origin/ | ||
- | |||
{{: | {{: | ||
+ | |||
+ | |||
+ | '' | ||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | </ | ||
\\ | \\ | ||
+ | '' | ||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | '' | ||
+ | \\ | ||
+ | '' | ||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | |||
+ | </ | ||
==== git merge --squash rama ==== | ==== git merge --squash rama ==== | ||
Línea 137: | Línea 194: | ||
\\ | \\ | ||
+ | |||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | '' | ||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | \\ | ||
+ | '' | ||
+ | < | ||
+ | %%{init: { ' | ||
+ | gitGraph | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
==== git merge rama ==== | ==== git merge rama ==== | ||
Línea 152: | Línea 247: | ||
<sxh bash> | <sxh bash> | ||
git fetch --prune | git fetch --prune | ||
- | git checkout | + | git switch |
git merge --ff-only origin/ | git merge --ff-only origin/ | ||
git fetch --prune | git fetch --prune | ||
- | git checkout | + | git switch |
git merge --ff-only origin/ | git merge --ff-only origin/ | ||
git fetch --prune | git fetch --prune | ||
- | git checkout | + | git switch |
git merge --ff-only origin/ | git merge --ff-only origin/ | ||
</ | </ | ||
Línea 171: | Línea 266: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git merge --ff-only develop | git merge --ff-only develop | ||
- | git checkout | + | git switch |
git merge --ff-only release | git merge --ff-only release | ||
</ | </ | ||
Línea 186: | Línea 281: | ||
<sxh bash> | <sxh bash> | ||
git fetch --prune | git fetch --prune | ||
- | git checkout | + | git switch |
git rebase origin/ | git rebase origin/ | ||
</ | </ | ||
Línea 208: | Línea 303: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git merge --squash lorenzo_42 | git merge --squash lorenzo_42 | ||
git commit -am " | git commit -am " | ||
Línea 222: | Línea 317: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git merge develop | git merge develop | ||
Línea 352: | Línea 447: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git rebase origin/ | git rebase origin/ | ||
vi index.html | vi index.html | ||
Línea 382: | Línea 477: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git merge --squash Lorenzo_3 | git merge --squash Lorenzo_3 | ||
vi index.html | vi index.html | ||
Línea 407: | Línea 502: | ||
</ | </ | ||
- | Ahora debemos como antes arreglar el conflicto editando el fichero '' | + | Ahora debemos como antes arreglar el conflicto editando el fichero '' |
<sxh bash> | <sxh bash> | ||
+ | git add index.html | ||
git merge --continue | git merge --continue | ||
</ | </ | ||
+ | | ||
+ | Es decir añadir el fichero que ha dado el conflicto con un '' | ||
+ | |||
Línea 417: | Línea 517: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
git merge develop | git merge develop | ||
vi index.html | vi index.html | ||
+ | git add index.html | ||
git merge --continue | git merge --continue | ||
</ | </ | ||
\\ | \\ | ||
- | ===== Stash ===== | ||
- | Hay veces que queremos guardar temporalmente los cambios para despues volver a ellos, por ejemplo si queremos cambiar de rama. | ||
- | |||
- | git contiene una orden para hacer eso: | ||
- | <sxh bash> | ||
- | git stash | ||
- | </ | ||
- | |||
- | Y si luego queremos recuperar los cambios se hace con: | ||
- | |||
- | <sxh bash> | ||
- | git stash pop | ||
- | </ | ||
===== Recetas ===== | ===== Recetas ===== | ||
Línea 443: | Línea 531: | ||
<sxh bash> | <sxh bash> | ||
- | git fetch --prune && git checkout | + | git fetch --prune && git switch |
</ | </ | ||
Línea 449: | Línea 537: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
</ | </ | ||
Línea 455: | Línea 543: | ||
<sxh bash> | <sxh bash> | ||
- | git checkout | + | git switch |
</ | </ | ||
+ | * Proceso completo para hacer una modificacion en la propia rama y ponerla en develop | ||
+ | <sxh bash> | ||
+ | #Día 1:Lunes | ||
+ | git fetch --prune && git switch develop && git merge --ff-only origin/ | ||
+ | git branch lorenzo_45 | ||
+ | git switch lorenzo_45 | ||
+ | git push --set-upstream origin lorenzo_45 | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git push | ||
+ | |||
+ | #Día 2:Martes | ||
+ | git fetch --prune && git switch develop && git merge --ff-only origin/ | ||
+ | git switch lorenzo_45 | ||
+ | git merge develop | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git push | ||
+ | |||
+ | #Día 3:Miercoles | ||
+ | git fetch --prune && git switch develop && git merge --ff-only origin/ | ||
+ | git switch lorenzo_45 | ||
+ | git merge develop | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git push | ||
+ | |||
+ | |||
+ | #Día 4: Jueves | ||
+ | git fetch --prune && git switch develop && git merge --ff-only origin/ | ||
+ | git switch lorenzo_45 | ||
+ | git merge develop | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git commit -m " | ||
+ | git push | ||
+ | |||
+ | |||
+ | #Día 5: Viernes | ||
+ | git fetch --prune && git switch develop && git merge --ff-only origin/ | ||
+ | git switch lorenzo_45 | ||
+ | git merge develop | ||
+ | |||
+ | git switch develop | ||
+ | git merge --squash lorenzo_45 | ||
+ | git commit -am " | ||
+ | git push | ||
+ | #Si falla el push hacer el fetch y rebase | ||
+ | git fetch --prune | ||
+ | git rebase origin/ | ||
+ | git push | ||
+ | |||
+ | git push origin --delete lorenzo_45 | ||
+ | git branch --delete --force lorenzo_45 | ||
+ | |||
+ | </ | ||