You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tagging: Small amount of grammatical cleanup, enhance some explanations
Among other things:
- explain that pushing tags pushes both types
- add second variation of how to delete remote tags
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/tagging.asc
+27-10Lines changed: 27 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,27 @@
2
2
=== Tagging
3
3
4
4
(((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.
8
8
9
9
==== Listing Your Tags
10
10
11
-
Listing the available tags in Git is straightforward.
11
+
Listing the existing tags in Git is straightforward.
12
12
Just type `git tag` (with optional `-l` or `--list`):(((git commands, tag)))
13
13
14
14
[source,console]
15
15
----
16
16
$ git tag
17
-
v0.1
18
-
v1.3
17
+
v1.0
18
+
v2.0
19
19
----
20
20
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.
22
22
23
23
You can also search for tags that match a particular pattern.
24
24
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:
26
26
27
27
[source,console]
28
28
----
@@ -217,6 +217,12 @@ To git@github.com:schacon/simplegit.git
217
217
218
218
Now, when someone else clones or pulls from your repository, they will get all your tags as well.
219
219
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
+
220
226
==== Deleting Tags
221
227
222
228
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)
229
235
----
230
236
231
237
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>`:
233
241
234
242
[source,console]
235
243
----
@@ -238,9 +246,18 @@ To /git@github.com:schacon/simplegit.git
238
246
- [deleted] v1.4-lw
239
247
----
240
248
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
+
241
258
==== Checking out Tags
242
259
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:
0 commit comments