git describe
git
Uso
git describe [--tags] [--dirty]Nombra el commit actual a partir de la etiqueta más cercana, como v1.2.0-5-gabc1234; por defecto solo ve etiquetas anotadas, así que las ligeras necesitan --tags y un repositorio sin etiquetas necesita --always.
Opciones habituales
| Opción | Significado |
|---|---|
| --tags | use lightweight tags too, not just annotated ones |
| --dirty | append -dirty when the working tree has changes |
| --always | fall back to a bare hash when no tag is found |
| --long | always the full tag-count-hash form |
| --abbrev=<n> | how many hash digits to print |
| --match <pattern> | only consider matching tags |
Ejemplos
git describe --tags --dirtyprints something like v1.2.0-5-gabc1234-dirty
git describe --alwaysnever fails, even in a repository with no tags
git describe --match "v*" --longignores tags that are not versions
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 describe?
Nombra el commit actual a partir de la etiqueta más cercana, como v1.2.0-5-gabc1234; por defecto solo ve etiquetas anotadas, así que las ligeras necesitan --tags y un repositorio sin etiquetas necesita --always.
Q. ¿Cómo se escribe?
git describe [--tags] [--dirty] — los corchetes marcan lo que puedes omitir.
Q. ¿Cuántas opciones vale la pena saber?
Aquí van 6; la lista completa está en man git. Este comando está en git.
Comandos relacionados
página man: man git-describe