tag ,一个记录点,在茫茫commits中找到你需要的那个commit
查看所有标签
创建tag
1
2
3
4
5
6
7
8
9
| # 给当前commit 添加tag
git tag <tag_name>
git tag v1.0.0
# 给历史commit 添加tag
git tag -a <tag_name> <commit_hash> -m "Tag message"
|
删除本地tag
删除远程tag
1
2
| git push origin :refs/tags/v1.0.0
# 删除的时候git push [目标仓库名称] :refs/tags/[标签名称] 这里的refs 和tags后面都有s
|
从tag切一个分支出来
切换到一个tag所在的commit
得到了一些提示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| Note: switching to 'v0.0.1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 625ec7f 提交git练习记录文件
|
把这个tag所在的这次 commit 变成一个分支
毕竟分支更好操作,现在我们已经在一个游离状态,那么,去创建一个分支。
查看标签详情