Cambiar mensaje de Git stash [duplicar]


Esta pregunta ya tiene una respuesta aquí:

Tengo un alijo guardado para el futuro que quiero dar un nombre significativo. Si bien es posible pasar un mensaje como argumento a git stash save, ¿hay alguna manera de agregar un mensaje a un alijo existente?

Author: CharlesB, 2011-11-14

5 answers

Puede editar directamente los mensajes almacenados en .git/logs/refs/stash.

Sé que probablemente no es ideal, pero debería funcionar de todos modos.

 48
Author: yibe,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-14 17:20:15

No sin estallar y guardar de nuevo.

 15
Author: manojlds,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-14 16:30:27

(Expandiendo la respuesta de manojlds.) La cosa más simple para adjuntar un mensaje es de hecho a un-stash y re-stash con un mensaje, hay un comando git stash branch que le ayudará a hacer esto.

git stash branch tmp-add-stash-message
git stash save "Your stash message"

El único inconveniente es que este alijo ahora parece originarse en la rama tmp-add-stash-message. Después, puede obtener otra rama y eliminar esta rama temporal.

Por supuesto, esto asume que su copia de trabajo está limpia, de lo contrario puede guardar los cambios actuales: -)

 11
Author: krlmlr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-15 10:42:42

Sí, hay una manera, puedes probar esto:

git stash store -m "your descriptive message here" stash@{1}

Esto creará un nuevo Alijo llamado stash@{0} con el mensaje anterior.
Este Alijo es el mismo que stash@{1}.

Luego puedes eliminar el antiguo alijo@{1} anterior con:

git stash drop stash@{2} # el alijo@{1} se ha convertido en alijo@{2} cuando se ha creado un nuevo alijo.

NOTA: no puedes hacer esto con stash@{0}: git stash store -m "message here" stash@{0} no hará nada.

 9
Author: Ryan Le,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-28 08:58:07

Aquí hay algunos comandos para ayudarte a pop y guardar de nuevo como @ manojlds sugiere:

git stash #save what you have uncommitted to stash@{0}
git stash pop stash@{1} #or another <stash> you want to change the message on
# only if necessary, fix up any conflicts, git reset, and git stash drop stash@{1}
git stash save "new message"
git pop stash@{1} #get back to where you were if you had uncommitted changes to begin with
 1
Author: Jayen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-06-09 07:52:35