Skip to content

Commit 40c6c6f

Browse files
authored
Merge pull request #1181 from rpjday/topic/rpjday/tagging
Tagging: Small amount of grammatical cleanup, enhance some explanations
2 parents 1cb9415 + 3cf0752 commit 40c6c6f

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

book/02-git-basics/sections/tagging.asc

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
=== Tagging
33

44
(((tags)))
5-
Like most VCSs, Git has the ability to tag specific points in history as being important.
6-
Typically people use this functionality to mark release points (v1.0, and so on).
7-
In this section, you'll learn how to list the available tags, how to create new tags, and what the different types of tags are.
5+
Like most VCSs, Git has the ability to tag specific points in a repository's history as being important.
6+
Typically, people use this functionality to mark release points (`v1.0`, `v2.0` and so on).
7+
In this section, you'll learn how to list existing tags, how to create and delete tags, and what the different types of tags are.
88

99
==== Listing Your Tags
1010

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

1414
[source,console]
1515
----
1616
$ git tag
17-
v0.1
18-
v1.3
17+
v1.0
18+
v2.0
1919
----
2020

21-
This command lists the tags in alphabetical order; the order in which they appear has no real importance.
21+
This command lists the tags in alphabetical order; the order in which they are displayed has no real importance.
2222

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

2727
[source,console]
2828
----
@@ -217,6 +217,12 @@ To [email protected]:schacon/simplegit.git
217217

218218
Now, when someone else clones or pulls from your repository, they will get all your tags as well.
219219

220+
[NOTE]
221+
.`git push` pushes both types of tags
222+
====
223+
Pushing tags using `git push <remote> --tags` does not distinguish between lightweight and annotated tags; there is no simple option that allows you to select just one type for pushing.
224+
====
225+
220226
==== Deleting Tags
221227

222228
To delete a tag on your local repository, you can use `git tag -d <tagname>`.
@@ -229,7 +235,9 @@ Deleted tag 'v1.4-lw' (was e7d5add)
229235
----
230236

231237
Note that this does not remove the tag from any remote servers.
232-
In order to update any remotes, you must use `git push <remote> :refs/tags/<tagname>`:
238+
There are two common variations for deleting a tag from a remote server.
239+
240+
The first variation is `git push <remote> :refs/tags/<tagname>`:
233241

234242
[source,console]
235243
----
@@ -238,9 +246,18 @@ To /[email protected]:schacon/simplegit.git
238246
- [deleted] v1.4-lw
239247
----
240248

249+
The way to interpret the above is to read it as the null value before the colon is being pushed to the remote tag name, effectively deleting it.
250+
251+
The second (and more intuitive) way to delete a remote tag is with:
252+
253+
[source,console]
254+
----
255+
$ git push origin --delete <tagname>
256+
----
257+
241258
==== Checking out Tags
242259

243-
If you want to view the versions of files a tag is pointing to, you can do a git checkout, though this puts your repository in ``detached HEAD'' state, which has some ill side effects:
260+
If you want to view the versions of files a tag is pointing to, you can do a `git checkout` of that tag, although this puts your repository in ``detached HEAD'' state, which has some ill side effects:
244261

245262
[source,console]
246263
----

0 commit comments

Comments
 (0)