One minute
60 Words
Nov 26, 2025
TIL - gitsha with dirty
git describe --always --dirty --match=''
This command return the gitsha of HEAD, in short form, and attaches -dirty suffix if there is change in tracked files. 7e68a98, 7e68a98-dirty.
Staged files is also considered as dirty.
The --match="" avoid matching to any nearby git tags, and always return the gitsha.
This is helpful sometime in build system for tracking application version.