{"id":8,"date":"2015-08-31T15:58:50","date_gmt":"2015-08-31T15:58:50","guid":{"rendered":"http:\/\/madhurendra.com\/?p=8"},"modified":"2015-08-31T21:30:48","modified_gmt":"2015-08-31T16:00:48","slug":"simple-automatic-versioning","status":"publish","type":"post","link":"https:\/\/madhurendra.com\/simple-automatic-versioning\/","title":{"rendered":"Simple automatic versioning using git"},"content":{"rendered":"
Many times while working on projects its hard to keep track of which version is in staging server, which is on production and which other developers of team are working on, Especially when you are a small startup with limited number of resources. (Its really painful to setup automatic deployment in gitlab).<\/p>\n
Here is what i started following in every project\u00a0:
\nVersion of server should increase with number of commits, major increments will be done manually based on release date, number of issues solved. For automatic commit based\u00a0versioning add following lines to `.git\/hooks\/pre-commit`.<\/p>\n
`git add Version && echo $(cat Version)+0.0001 | bc | awk ‘{printf “%0.4f”, $0 > “Version”}’`<\/p>\n
Also make sure that file is executable by<\/p>\n
`chmod +x\u00a0.git\/hooks\/pre-commit`<\/p>\n
I follow following\u00a0version numbering system :
\n– `+1.00000` – Major version
\n– `+0.1` – Minor Version
\n– `+0.0001` – Commit<\/p>\n","protected":false},"excerpt":{"rendered":"
Many times while working on projects its hard to keep track of which version is in staging server, which is on production and which other developers of team are working on, Especially when you are a small startup with limited number of resources. (Its really painful to setup automatic deployment in gitlab). Here is what … <\/p>\n