Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I have a small github project, which I need to add an option to to output some version number on the commandline.

The problem is I have no idea how to "compute" the version number. Is this some random process? Should I just start at 1.0 (probably creating a tag or something), and put a number after . for fixes?

I know this question is a bit vague... I just had never to deal with this, and want to use some sane versioning scheme.


Im also interested into how to update this version number automatically, maybe using something like a git hook.

share|improve this question

marked as duplicate by gnat, Kilian Foth, GlenH7, Dan Pichelman, MichaelT Mar 1 '14 at 0:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

using any CI tool? Teamcity for one, can pass and handle versioning schemes – James Woolfenden Jun 12 '12 at 15:29
@JamesWoolfenden I'm using git, but git commits don't seem very useful (being SHAs). – Oliver Weiler Jun 12 '12 at 16:55
You may also find the following answer useful: >… – Charles Wood Feb 27 '14 at 22:41
up vote 4 down vote accepted

Have a look at Semantic Versioning. What constitutes a major, minor and patch version increment depends on your project, but the site is a good starting point. You might also want to include the first few digits of the git commit ID in the version, so you can find it later.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.