Git - 入门到熟悉_TAG管理

Posted 小小工匠

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git - 入门到熟悉_TAG管理相关的知识,希望对你有一定的参考价值。

文章目录


Pre

Git - 入门到熟悉_Git基本概念与核心命令

Git - 入门到熟悉_分支管理

Git - 入门到熟悉_远程仓库管理


常用命令

TAG和分支很像, 只不过TAG是只读的。

#查看当前
git tag
#创建分支
git tag <tag name> <branch name>
#删除分支
git tag -d <tag name>

# 把tag推送到远程仓库  命令格式为:git push origin [tagname]
git push origin v1.0.16

基于分支创建TAG 并推送到远程服务器


artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git branch
* master

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git tag tag_0816 master

 
artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git tag
tag_0816
 
artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git tag --list
tag_0816

 
artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git push origin tag_0816    # 把tag推送到远程仓库 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/yangshangwei/gitProject.git
 * [new tag]         tag_0816 -> tag_0816

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$



我们到 https://gitee.com/yangshangwei/gitProject.git 看一下


基于 提交点 来创建TAG并推送到远程服务器

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git log
commit 36a0f0253e4967e30dbcc7689eff872f72138444 (HEAD -> master, tag: tag_0816, origin2/master, origin/master)
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Tue Aug 16 05:18:54 2022 +0800

    8 commit

commit b685db4861c9d8ba7a4f251f3aa26ebca8b7a271
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Tue Aug 16 04:57:25 2022 +0800

    7 commit

commit 9f302ffcd77e703b02e9d185d085484f1e298c0a
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Mon Aug 15 00:34:03 2022 +0800

    第四次提交

commit 2d23d8a4a8b9f79f893ce7ef594624929b57d31c
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Mon Aug 15 00:24:25 2022 +0800

    第三次提交

commit 5e6d25b9e0f1bae23ce98facecf79ad4e97df174
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Sun Aug 14 23:55:34 2022 +0800

    第二次提交

commit 4ac59bd9186592662350d23f1cdfbe5c4f21f329
Author: yangshangwei <yswcomeon@gmail.com>
Date:   Sun Aug 14 23:02:58 2022 +0800

    init commit

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git tag 4_commit  2d23d8a4a8b9f79f893ce7ef594624929b57d31c

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git tag
4_commit
tag_0816

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$ git push origin 4_commit
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/yangshangwei/gitProject.git
 * [new tag]         4_commit -> 4_commit

artisan@LAPTOP-JF3RBRRJ MINGW64 /d/opt/gitdemo/gitProject (master)
$

OK, TAG功能很简单,就到这里了

以上是关于Git - 入门到熟悉_TAG管理的主要内容,如果未能解决你的问题,请参考以下文章

Git - 入门到熟悉_分支管理

Git - 入门到熟悉_分支管理

Git - 入门到熟悉_日志管理

Git - 入门到熟悉_日志管理

Git - 入门到熟悉_远程仓库管理

Git - 入门到熟悉_远程仓库管理