¿Cómo leer el último comentario de confirmación?
A menudo durante un commit ($ git -commit -m ""
), deseo leer mi último comentario para recordar qué progreso he hecho. ¿Hay una manera fácil de acceder directamente al último mensaje de confirmación a través de la línea de comandos? (Estoy usando Windows.)
6 answers
git show
Es el más rápido de escribir, pero también muestra la diferencia.
git log -1
Es rápido y sencillo.
git log -1 --pretty=%B
Si solo necesita el mensaje de confirmación y nada más.
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-09-03 12:09:58
En general:
git log -n
Te mostrará los últimos n
mensajes de confirmación
Más elegante-si quieres una visión general rápida de tus commits
git log --oneline -n
Esto mostrará solo la primera línea de los últimos n
mensajes de confirmación.
Puede guardar esto como un alias de git o un alias de shell con un comando más corto. Lo tengo en mi shell como glog
, por ejemplo, y puedo ver mis últimos 10 mensajes de confirmación con glog -10
.
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
2018-05-29 17:41:21
git log -1
mostrará el último mensaje de confirmación o git log -1 --oneline
si solo desea que se muestre el sha1 y el mensaje de confirmación asociado.
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-09-03 12:09:04
git log -1 branch_name
le mostrará el último mensaje de la rama especificada (es decir, no necesariamente la rama en la que está actualmente).
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-12-18 08:12:45
Para algo un poco más legible, ejecute este comando una vez:
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
Para que cuando corras:
git lg
Tienes una buena lectura. Para mostrar solo la última línea:
git lg -1
Solución encontrada aquí
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
2017-03-14 11:54:18
Hice esto
git reflog -1 | sed 's/^.*: //'
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
2018-08-01 01:10:34