June 08, 2012
For sometime I've thought that that using the commit count on a project would make a good version number algorithm. My idea has been to have a file in the project that contains a number. That number is created by a commit hook. Each commit increments the number. I guess this would be more of a "build" number than a true version number. Either way, it would eliminate all the trouble over how to come up with a reliable way to have a
MM.mm.pppp version number where
MM is the major release,
mm is the minor release, and
pppp is the patch number.
This command shows the total number of commits in the current repository for all developers.
git shortlog | grep -E '^[ ]+\w+' | wc -l
This command is a variation on the first command. It shows each developer's name and then the number of commits they've made to the repository.
git shortlog | grep -E '^[^ ]'
My next project will be to create a git commit hook that works with the first git shortlog command to populate a build count file.