专业java、php、iOS、C++、网页设计、平面设计、网络营销、游戏开发、前端与移动开发培训机构
git标签(tag)管理
tag 的作用
tag可以对git版本库中阶段性的重要的版本做一个标记(比如说 appStore 上线版本);- 我们可以通过
tag快速地定位到某个重要版本;
tag 的使用
- 添加
tag:git tag –a V1.0.0 –m “AppStore上线V1.0.0版本包含注册登录功能”git tag –a tag名称 –m “tag注释” #添加新标签 查看已有
tag:git tag -l: 只能看到tag名称,看不到注释V1.0.0git tag -n: 能看到tag名称和注释V1.0.0 AppStoreV1.0.0版本 V1.0.1 AppStoreV1.0.1版本git show tag名称,如git show V1.0.0: 可以看到tag名称, 谁打的tag, 打tag的时间 和 这个tag指向哪个提交tag V1.0.0 Tagger: Manager <[email protected]> Date: Tue Jun 14 22:51:54 2016 +0800 AppStoreV1.0.0版本 commit dfed15e8b5e687533839d315af9b397daee3da2d Author: Manager <[email protected]> Date: Tue Jun 14 22:43:38 2016 +0800
- 删除一个标签:
git tag -d 标签名如:git tag -d V1.0.0 - 将标签推送到服务器:
git push不会将tag提交到服务器- 推送单个标签
git push origin 标签名称如:git push origin V1.0.1 - 推送所有标签
git push origin --tags
- 推送单个标签
tag 的相关操作包括: 添加、删除、查看 、提交到服务器等
git tag –a V1.0.0 –m "name" #添加新标签
git tag #查看所有tag
git tag -n #查看所有 tag,带注释
git show V1.0.0 #查看某个标签及其对应版本的详细信息
git tag -d V1.0.0 #删除一个版本
git push origin V1.0.0 #将版本推送到服务器
git push origin --tags #推送所有标签