惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
H
Help Net Security
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
A
About on SuperTechFans
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
I
InfoQ
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
U
Unit 42
The Cloudflare Blog
Y
Y Combinator Blog

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
How to Use The Git-tag Feature
2021-05-08 · via jdhao's digital space

My notes on using tag feature of Git.

We can use git-tag to create a memorable name for a specific commit, for example, v1.0, v2.0.

Create tags#

Lightweight and annotated tags#

There are two different types of tag: lightweight and annotated tag.

To create lightweight tags, do not use -a option:

To create annotated tags, use -a option and -m (for tag message):

git tag -a v0.5  -m "some info about this commit"

For annotated tags, when we use git show {tag-name}, the tag message will also be displayed.

Tag a specific commit#

To tag a specific commit, we can provide its commit hash:

# in this example, 8a5cbc4 is the commit hash.
git tag -a v1.2 8a5cbc4 -m "some information related to this tag"

List tags#

To list tags, use git tag -l or just git tag.

Git-tag also supports globing for tags matching a pattern. For example, to list all tags in version 1.1 series, use git tag -l "v1.1.*".

Show a tag#

To show a tag, use git show {tag_name}, for example, git show v1.0.

Push tags to remote#

To push a tag to remote repo, we have to explicitly push it. git push origin {branch-name} does not work in this case.

# this will push tag v1.2 to origin
git push oirgin v1.2

To push all tags to remote, use command git push origin --tags.

Delete a tag#

To delete a tag, use git tag -d {tag-name}, for example, to delete tag v1.2, we use git tag -d v1.2.

To delete a tag in remote repo, use git push {remote-name} -d {tag-name}.

References#