

If the tag is a lightweight tag, then you'll see only the commit object.Ī key difference between annotated and non-annotated tags is in the use of git describe. If the tag is an annotated tag, you'll see the message and the tag object, followed by the commit.

In order to see what the tag contains, you can use git show, as you can with other git objects: Similarly, you shouldn't change a tag once it has been released to the wild either. To list the local repository's tags, run git tag without any arguments or, for a pattern, use -l with * as a wildcard:įinally, to get rid of tags, you can delete them with -d:ĭeleting tags are OK if you never made them publicly available, but you really should avoid deleting tags once you've pushed them to a publicly readable location. You can verify the signature of an existing tag with -v. This uses gpg to sign, based on your email address – though you can use -u to specify a different gpg identity instead. If we wanted to guarantee the authenticity of the tag, we could use -s on the git tag command. git/refs/tags/v1 will point to the tag object, which then points to the commit. This will create an (unsigned) annotated tag object, containing that message and a pointer to the commit object. If we want to make it as an annotated tag, we need to supply -a, and a message with -m: git/refs/tags/example, which points to the current commit. This creates a lightweight tag as a reference in. We can create a simple tag, based on the current repository's version, with: This may include release notes, the meta-information about the release, and optionally a signature to verify the authenticity of the commit to which it points. When using them, there is little difference between the two both will allow you to refer to a specific commit in a repository.Īn annotated tag creates an additional tag object in the Git repository, which allows you to store information associated with the tag itself. Git has two flavours of tags annotated and non-annotated. In other words, tags are immutable references.
#Git tag show update#
When it is, a commit will automatically update the master reference to point to that new commit in other words, branches are mutable references.Ī tag, on the other hand, is created to point to a specific commit and thereafter does not change, even if the branch moves on. What's the difference between tags and branches? The workspace is (almost always) associated with a branch, called master by default. A tag is like a branch, in that it identifies a specific commit with a descriptive label. The second, which we'll introduce here, is tags. When we switch between two branches, we're really using the descriptive label to identify a specific commit to switch to. The first, we've already seen, is branches. Git provides a couple of mechanisms for identifying changes by labels instead of by unique hash values. You can subscribe to the feed if you want to receive new instalments automatically. This week's Git Tip of the Week is about working with tags.
