git show
git
Uso
git show [<object>|<commit>:<path>]Imprime un commit con su mensaje y su diff; la forma <commit>:<ruta> saca una versión antigua del archivo sin tocar tu copia de trabajo.
Opciones habituales
| Opción | Significado |
|---|---|
| --stat | file summary instead of the full patch |
| --name-only | list the paths the commit touched |
| -s | message only, no diff |
| <commit>:<path> | print the file as it was in that commit |
| --pretty=fuller | show author and committer dates separately |
Ejemplos
git show HEADthe message and diff of the last commit
git show HEAD~2:src/app.tsprints an old version of a file without touching your copy
git show --stat v1.2.0what the tagged commit changed, file by file
Lo confuso es que deshacer tiene varias formas: mover a dónde apunta una rama no es lo mismo que añadir un commit que la revierte.
Cómo leerlo
- Los corchetes [ ] marcan una parte que puedes omitir.
- Los puntos suspensivos … indican que puedes poner varios.
- Las opciones distinguen mayúsculas: en algunos comandos -r y -R no hacen lo mismo.
Preguntas
Q. ¿Qué hace git show?
Imprime un commit con su mensaje y su diff; la forma <commit>:<ruta> saca una versión antigua del archivo sin tocar tu copia de trabajo.
Q. ¿Cómo se escribe?
git show [<object>|<commit>:<path>] — los corchetes marcan lo que puedes omitir.
Q. ¿Cuántas opciones vale la pena saber?
Aquí van 5; la lista completa está en man git. Este comando está en git.
Comandos relacionados
página man: man git-show