I have often noticed inconsistencies in the release numbering of nightly builds, making it very difficult to detect which version I am really using.
For instance, I recall using a nightly tagged 6.something-RC which was then superseded by a later 5.0.something.
Even right now, the stable version (which has been out for a while) is numbered 5.1.2 whereas the latest nightly reports 5.1.0-1171 (and BTW after March it is even supposed to belong to the 6.x release cycle, not 5.x any longer).
This way, even reporting bugs or following bug reports / corrections is quite difficult.
Could someone please explain me if there’s something I am getting wrong?
You are getting everything right. Basically the 6.0 nightly existed before 5.1 was released. Past that point Wayne reversed prior not very popular decision to tag dev branch with future version instead of past released version.
So now nightlies are 5.1.0-xxxx-gYYYYYY where xxxx is number of commits past 5.1.0 and YYYYYY is hash of the commit the build is based on. When you report bugs that YYYYYYY is the important part since it allows devs to easily pinpoint exactly what code is in the build that has the bug.
The reason why nightlies are 5.1.0-something and not 5.1.2-something is because 5.1.0 is the point where nightlies branched off of stable. From that point 5.1.x releases only get bugfixes which are cherry-picked commits from dev (nightly) branch. Tehcnically nightlies are descendants of 5.1.0, as are 5.1.x builds. 5.1.0-something nightlies are part of v6 cycle and will stay labeled that way until v6 is released.
To make things a bit more complicated 5.1.2-something (and probably later 5.1.3-something) also exist as 5.1 bugfix development nightly builds. So, despite the numbers, 5.1.0-something is “newer” than 5.1.2-something, although the development has branched so that comparing is meaningless.