When you look online for versioning best practices, it almost always comes up with SemVer, or PEP440 for python packages.
My question is: which versioning convention does git follow, when, for example, listing tags with sort=v:refname?
I'm a bit confused, because SemVer considers 1.0.0-2 to be "Version 1.0.0 pre-release 2", and 1.0.0+2 to be "Version 1.0.0 build 2" (grammar-for-valid-semver-versions). However, the following test shows that git sorts versions with a - suffix after those with a "+" suffix, and after the plain version (with no suffix). It looks more like PEP440 ordering.
$ mkdir test-git && cd test-git && git init && touch a && git add a && git commit -m 'initial'
$ for v in 3.6.9 3.6.9-0 3.6.9-1 3.6.9-2 3.6.9+0 3.6.9+1 3.6.10 3.6.10-0 3.6.10-1 3.6.10-2 3.6.10+1 3.6.10+2; do git tag $v; done
$ git tag -l
3.6.10
3.6.10+1
3.6.10+2
3.6.10-0
3.6.10-1
3.6.10-2
3.6.9
3.6.9+0
3.6.9+1
3.6.9-0
3.6.9-1
3.6.9-2
$ git tag -l --sort=v:refname # same output than git tag -l | sort -V
3.6.9
3.6.9+0
3.6.9+1
3.6.9-0
3.6.9-1
3.6.9-2
3.6.10
3.6.10+1
3.6.10+2
3.6.10-0
3.6.10-1
3.6.10-2
Some context: I'm asking this question because I'm trying to figure out how to properly manage versioning of a forked docker image build (which adds some files that do not interfere on how the app works). + does not exist with docker, so I wanted to go for - for PEP440-like post-releases. SemVer says that - is pre-release. Git seems to agree with PEP440. I'm confused.