Difference between revisions of "Git, Stashing"
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Recuperar stash== | ==Recuperar stash (apply)== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
git stash apply stash@{2} # Recuperar stash con su identificador | git stash apply stash@{2} # Recuperar stash con su identificador | ||
git stash apply # Recuperar último stash | git stash apply # Recuperar último stash | ||
</syntaxhighlight> | |||
==Deshacer recuperación de stash== | |||
No existe un comando ''per se'' pero se puede ejecutar lo siguiente, aunque no siempre funciona (aparentemente cuando hay conflictos al aplicar el ''stash''). | |||
<syntaxhighlight lang="bash"> | |||
git stash show -p stash@{0} | git apply -R # Deshacer stash usando identificador | |||
git stash show -p | git apply -R # Deshacer último stash | |||
</syntaxhighlight> | |||
==Crear una rama a partir de un stash== | |||
<syntaxhighlight lang="bash"> | |||
git stash branch ramaNuevaNombre stashID | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category: Git]] | [[Category: Git]] |
Revision as of 19:09, 12 November 2013
Stashing significa esconder, es una técnica que se usa en Git para guardar el trabajo en un determinado momento, evitando hacer un commit de algo que tal vez no lo merezca. El trabajo queda escondido y se puede volver a usar en otro momento más adelante, se aplica como un parche que ejecuta cambios sobre el trabajo actual.
Esconder trabajo actual
git stash
Listar los stashes (escondidos)
git stash list
Recuperar stash (apply)
git stash apply stash@{2} # Recuperar stash con su identificador
git stash apply # Recuperar último stash
Deshacer recuperación de stash
No existe un comando per se pero se puede ejecutar lo siguiente, aunque no siempre funciona (aparentemente cuando hay conflictos al aplicar el stash).
git stash show -p stash@{0} | git apply -R # Deshacer stash usando identificador
git stash show -p | git apply -R # Deshacer último stash
Crear una rama a partir de un stash
git stash branch ramaNuevaNombre stashID