I 'm just learning to give project versions.

I understand writing details about the changes in my project when committing, but where should I put my version number for my project?

  • You would tag a particular commit with a version. See git-scm.com/book/en/Git-Basics-Tagging – user40980 Aug 26 '13 at 17:39
  • @MichaelT why not make it an answer so I can choose you? – Louis Hong Aug 26 '13 at 17:41
  • 1
    I'll look into doing so (with a bit more than a link... unless someone else does so first). However questions about how tools work is more appropriate for Stack Overflow than P.SE (see how to use tags in GIT and Git Tags & Branches). – user40980 Aug 26 '13 at 17:47

To build on MichaelT's answer, you can just add a Git "tag" to mark a particular commit as a canonical version of your code.

Assuming your most-recent commit on the master branch is the commit you would like to tag:

$ git tag 0.1.0

...or whatever version you would like to set it to. In the future, if you, or someone else would like to work with that specific version of your code, all that would need to be done (after an initial git-clone of your repository) would be to run:

$ git checkout tags/0.1.0

If you are looking for a sensible scheme to follow for your projects' versions, I highly recommend SemVer, as following a standard scheme for your projects' version makes it much easier to parse (if the need ever arises). SemVer also provides guidelines as to how to bump your version numbers.

  • Is the tag feature available in the Github GUI? – Louis Hong Aug 27 '13 at 6:46
  • If you are referring to the web interface of GitHub, then no, it does not look like it is supported. If you are referring to the GitHub app for Mac, strangely enough, I do not see it in there either. However, if you are looking for a decent, graphical Git client, I highly recommend SourceTree. – nesv Aug 27 '13 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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