Skip to content

Commit 49070d2

Browse files
committed
Add notes on git tags
1 parent 99e5240 commit 49070d2

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
"odio",
204204
"OKMM",
205205
"onds",
206+
"oneline",
206207
"opengraph",
207208
"orci",
208209
"pagefind",

content/git/tags.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
+++
2+
title="Tags"
3+
date = 2026-05-18
4+
extra = { series = "Git" }
5+
taxonomies = { tags = ["Git"] }
6+
+++
7+
8+
# See existing tags
9+
10+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_listing_your_tags>
11+
12+
List all
13+
14+
```sh
15+
git tag
16+
```
17+
18+
Filter listing using wildcard pattern (eg.)
19+
20+
```sh
21+
git tag -l "v1.*"
22+
```
23+
24+
## See details about one of the tags
25+
26+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_annotated_tags>
27+
28+
```sh
29+
git show [TagName]
30+
```
31+
32+
# Creating Tags
33+
34+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_creating_tags>
35+
36+
For annotated tags
37+
38+
```sh
39+
git tag -a [TagName] -m $"Tag Message"
40+
```
41+
42+
For lightweight tags
43+
44+
```sh
45+
git tag [TagName]
46+
```
47+
48+
# Tagging previous commits
49+
50+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_tagging_later>
51+
52+
Get the `commit checksum` of the commit you want to tag.
53+
You can use `git log --pretty=oneline` to see recent commits.
54+
You need to just add the `commit checksum` to the end (seems to be at least 4 characters if that makes it unique)
55+
56+
```sh
57+
git tag -a [TagName] [CommitChecksum]
58+
```
59+
60+
For Example
61+
62+
```sh
63+
git tag -a v1.2 9fceb02
64+
```
65+
66+
# Pushing Tags to Remote
67+
68+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_sharing_tags>
69+
70+
```sh
71+
git push --tags
72+
```
73+
74+
# Deleting Tags
75+
76+
Source: <https://stackoverflow.com/questions/5480258/how-can-i-delete-a-remote-tag>
77+
Source: <https://git-scm.com/book/en/v2/Git-Basics-Tagging#_deleting_tags>
78+
79+
To delete locally use
80+
81+
```sh
82+
git tag --delete [TagName]
83+
```
84+
85+
To delete on the remote use
86+
87+
```sh
88+
git push origin --delete [TagName]
89+
```

0 commit comments

Comments
 (0)