git修改指定tag的bug

git tag修复bug

1、环境搭建

cd test_tag
git init
git remote
git add a.txt
git commit -m "first commit"
# 打tag
git tag -a v1.0 -m "v1.0版本发布"
# 或
git tag v1.0

# 推送tag
git push origin v1.0
git add b.txt
git commit -m "second commit"

git add c.txt
git commit -m "third commit"

2、修复tag的bug

#查看所有tag
git tag

# 查看tag的版本号
git show v1.0
# 新建分支,并回滚到指定tag版本
git branch bugfix
git checkout  bugfix
git reset --hard xxxxxxxxxx
# 在bugfix分支上修复tag v1.0存在的bug
# 修复完,打tag

git add a.txt
git commit -m "tag v1.0 修复bug"

git tag v1.0.1

3、合并修复完的分支

  • 本地合并到master,并推送到远程仓库
# 切换到主分支
git checkout master

# 合并修改bug的分支
git merge bugfix
# 解决合并时的冲突
<<<<<<Head到======这个是当前分支,也就是master分支的内容
从======到>>>>>>>bugfix
# 推送更新到远程
git push origin master
  • 也可以推送新分支到远程仓库,在远程仓库中合并分支
git push origin bugfix

4、推送标签到远程

# git push命令是不会推送标签,标签必须手动推送到远程仓库
# 推送所有tag
git push origin --tags 
# 推送指定tag
git push origin v1.0.1
博客内容仅供参考,部分参考他人优秀博文,仅供学习使用
原文地址:https://www.cnblogs.com/linagcheng/p/14606075.html