git tag

By  on  

git tag is used to pin down a given revision as significant, often for the purpose of officially releasing code.  Once a tag is created, it's often referred to by build and deploy scripts instead of the tag's represented commit.  Tagging revisions  and deleting tags in git is easy -- let me show you how to do it!

Tagging a Revision

Assuming you're at the revision you want to tag, git tag {tagname} is the format to use:

git tag 0.1.0

You can name the tag whatever you'd like but oftentimes the tag is named via a release number system like 0.1.0, 0.1.1, 0.2.0, and so on.

Pushing Tags

You can create a tag locally but they aren't automatically pushed to the remote repository -- you must do that manually:

git push --tags

Don't forget to push your tags!

Deleting Tags

If you want to delete or remove a tag from history, you may do so using the -d flag:

git tag -d 0.1.0
git push origin :refs/tags/0.1.0

Unless you do a fair bit of tagging, you likely have to look back on a few of the commands when the time comes -- at least I do!

Recent Features

  • By
    LightFace:  Facebook Lightbox for MooTools

    One of the web components I've always loved has been Facebook's modal dialog.  This "lightbox" isn't like others:  no dark overlay, no obnoxious animating to size, and it doesn't try to do "too much."  With Facebook's dialog in mind, I've created LightFace:  a Facebook lightbox...

  • By
    6 Things You Didn’t Know About Firefox OS

    Firefox OS is all over the tech news and for good reason:  Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript.  Firefox OS has been rapidly improving...

Incredible Demos

  • By
    CSS Filters

    CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let's have...

  • By
    Unicode CSS Classes

    CSS class name structure and consistency is really important; some developers camelcase classnames, others use dashes, and others use underscores.  One thing I've learned when toying around by HTML and CSS class names is that you can actually use unicode symbols and icons as classnames.

Discussion

  1. Speaking of Tags, here is an one-liner that will automatically checkout the latest tag of a git repository.

    git checkout $(git describe --tags $(git rev-list --tags --max-count=1))

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!