In git, every commit generates a unique SHA1 hash id. You can see the id for each commit when running git log
. If you want a 5 digit number for the most recent commit, you could do something like git log --pretty=oneline --abbrev-commit --abbrev=5 -1
. For one of my repos the output looks like this:
$ git log --pretty=oneline --abbrev-commit --abbrev=5 -1
3b405... fixed css for page title.
You can experiment with the other options to git log
to customize the format if needed. Of course, if the repository has enough commits, there's always the possibility that 5 digits will not be enough to guarantee uniqueness, but for small enough projects it may do.