If every release is marked with an annotated tag, git describe is what you need (cite from man page):
git-describe - Show the most recent tag that is reachable from a commit
If your last released version is for example 2.6.9, git describe will give you the following output:
2.6.9-<NUMCOMMITS>-g<CURRENTREV>
If your current branch points directly to 2.6.9, NUMCOMMITS and CURRENTREV will not be printed and the command only yields 2.6.9.
However, if you did some commits since 2.6.9 (e.g. 3), NUMCOMMITS will be 3 and CURRENTREV will be the 7 chars of the abbreviated last commit hash (e.g. 2597536):
2.6.9-3-g2597536
Same could be achieved for unannotated tags using the --tags switch:
git describe --tags