Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions book/02-git-basics/sections/tagging.asc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this section, you'll learn how to list the available tags, how to create new
==== Listing Your Tags

Listing the available tags in Git is straightforward.
Just type `git tag`:(((git commands, tag)))
Just type `git tag` (with optional `-l` or `--list`):(((git commands, tag)))

[source,console]
----
Expand All @@ -20,7 +20,7 @@ v1.3

This command lists the tags in alphabetical order; the order in which they appear has no real importance.

You can also search for tags with a particular pattern.
You can also search for tags that match a particular pattern.
The Git source repo, for instance, contains more than 500 tags.
If you're only interested in looking at the 1.8.5 series, you can run this:

Expand All @@ -39,9 +39,17 @@ v1.8.5.4
v1.8.5.5
----

[NOTE]
.Listing tag wildcards requires `-l` or `--list` option
====
If you want just the entire list of tags, running the command `git tag` implicitly assumes you want a listing and provides one; the use of `-l` or `--list` in this case is optional.

If, however, you're supplying a wildcard pattern to match tag names, the use of `-l` or `--list` is mandatory.
====

==== Creating Tags

Git uses two main types of tags: lightweight and annotated.
Git supports two types of tags: _lightweight_ and _annotated_.

A lightweight tag is very much like a branch that doesn't change – it's just a pointer to a specific commit.

Expand Down Expand Up @@ -93,7 +101,7 @@ That shows the tagger information, the date the commit was tagged, and the annot
(((tags, lightweight)))
Another way to tag commits is with a lightweight tag.
This is basically the commit checksum stored in a file – no other information is kept.
To create a lightweight tag, don't supply the `-a`, `-s`, or `-m` option:
To create a lightweight tag, don't supply any of the `-a`, `-s`, or `-m` options, just provide a tag name:

[source,console]
----
Expand Down