The SHA is just one representation of a version (albeit canonical). The git describe
command offers others and does so quite well.
For example, when I run git describe
in my master branch of my Java memcached client source, I get this:
2.2-16-gc0cd61a
That says two important things:
- There have been exactly 16 commits in this tree since 2.2
- The exact source tree can be displayed on anyone else’s clone.
Let’s say, for example, you packaged a version
file with the source (or even rewrote all the content for distribution) to show that number. Let’s say that packaged version was 2.2-12-g6c4ae7a
(not a release, but a valid version).
You can now see exactly how far behind you are (4 commits), and you can see exactly which 4 commits:
# The RHS of the .. can be origin/master or empty, or whatever you want.
% git log --pretty=format:"%h %an %s" 2.2-12-g6c4ae7a..2.2-16-gc0cd61a
c0cd61a Dustin Sallings More tries to get a timeout.
8c489ff Dustin Sallings Made the timeout test run on every protocol on every bui
fb326d5 Dustin Sallings Added a test for bug 35.
fba04e9 Valeri Felberg Support passing an expiration date into CAS operations.