Git基操-tag
打标签
git tag -a 0.1.3 -m "Release version 0.1.3"
详解:
git tag 是命令
-a 0.1.3是增加 名为0.1.3的标签
-m 后面跟着的是标签的注释
打标签的操作发生在我们commit修改到本地仓库之后。
相关操作
提交
git add .
git commit -m “fixed some bugs”
git tag -a 0.1.3 -m “Release version 0.1.3″
分享提交标签到远程服务器上
git push origin master
git push origin --tags
–tags参数表示提交所有tag至服务器端,普通的git push origin master操作不会推送标签到服务器端。
切换到已有Tag
git tag --list // 查看已有tag列表
git checkout [tag/branch/commit] // 切换到指定tag/branch/commit都是此命令
删除标签的命令
git tag -d 0.1.3
删除远端服务器的标签
git push origin :refs/tags/0.1.3
修改tag的代码
1) 根据tag创建分支
git branch branchname tagname
或
git checkout branchname
2) 提交更改的code
git add .
git commit -m "Fix included"
或者使用 cherry-pick 合并一个commit
git cherry-pick {commitid}
3) 删除本地tag,并重新创建该tag
git tag -d {tagname}
git tag {tagname}
4) 删除远程tag,并push code重新生成远程tag
git push origin --delete {tagname} // deletes original remote tag
git push origin {tagname} // creates new remote tag
5) Update local repository with the updated tag
git fetch --tags
Last updated