{"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

Continue reading<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[2,3],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-git","category-linux","item-wrap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pciGs2-8","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":7,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":15,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/posts\/8\/revisions\/15"}],"wp:attachment":[{"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/madhurendra.com\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}