Why should I use tags vs. release/beta branches for versioning?

wufoo picture wufoo · Mar 21, 2012 · Viewed 51.2k times · Source

I've been using git for about a year and would like to use tagging to, well, tag commits at different versions. I've found lots of info on the commands to use to work with tags, but what I'd like to know is why use tagging at all if I can just create a new branch called 1.1.0 and not have to cloud my mind with a whole new set of git commands?

There has to be a lot of good reasons for tagging rather than branching but I'd like to know what those advantages are.

Answer

AD7six picture AD7six · Mar 21, 2012

A tag is immutable.

Whereas you can create a branch named "1.0.0" - you, or anyone with commit rights, can also then simply push to that branch (deliberately or not) and change what 1.0.0 means.

You can't do that with a tag, once you create a tag - that's it; Tag 1.0.0 means exactly that and can't be changed*.

That's the main practical difference between a tag and a branch

* You can delete and recreate a tag thereby changing a tag, but certainly not by accident.