Versioning in Git using Tags

Recently, I looked at tagging different versions of my project. First, I reviewed the Git manual1 and found the instructions for creating an annotated tag.

git tag -a v0.2 -m 'development version'

Once you have a tag, your list of tags can be reviewed using

git tag

Of course, at this point, the tag is still on the local repo. So, to push this tag to the master server, I used the following, where v0.2 is my tag.

git push origin v0.2

Now, when a team member wants to clone or fetch the latest repo, they will get the tag as well. Then, if they need the code from a tagged version, they can check out the tag as follows.2

git checkout tags/v0.2

 

References

Git Manual, 2012, accessed  21 April 2014, <http://git-scm.com/book/en/Git-Basics-Tagging&gt;.

Stack Overflow, 2012, accessed  21 April 2014, <http://stackoverflow.com/questions/791959/how-to-use-git-to-download-a-particular-tag&gt;