我们在产品release之后,通常会使用tag记录这一历史时刻,但是,在整个产品的生命周期中,这个release可能会出现bug,需要fix,也就是需要修改tag的code,以下是流程
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