How to tag a release in Git

Git-Logo-2ColorLike in Subversion, Git supports tags. Most developers use tags to “freeze” a bunch of files at a moment in time, much like a snapshot. Commonly this feature is used whenever a new release of your software is… well… released.

Xcode does not support this feature via the GUI, but of course Git does. Let’s see how to do this from the command line.

Tagging the current branch

You can create a tag from whatever you’ve just committed, no matter which branch this is on. Simply head over to your project and type the following:

This will create a tag called “v1.1″ with the comment “Version 1.1″. To see a list of all your tags, type

Tagging a previous commit

If you’ve forgotten to create a tag from an earlier commit you can do that too. Simply specify part of that ugly long hash Git creates with every commit. They’re not easy to remember of course, so let’s list each commit to find the one you need:

Say you wanted to create a tag from the second commit, the one that reads “wish I tagged this”. Tag it just like above, but add the first few hash digits like so:

Pushing Tags to a remote

Just like branches, your tags are not automatically pushed to a remote. You must specify this explicitly. You also need to know what your remote is called. Let’s assume it’s called “Remote”, here’s how you’d push the tag we’ve just created:

For a more detailed explanation, check out this excellent article from Git SCM.

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!