您还可以通过单个git push
命令将旧标签/分支复制到新名称并删除旧名称,而无需检出远程标签来重命名。
远程标签重命名/远程分支→标签转换:(注意::refs/tags/
)
git push <remote_name> <old_branch_or_tag>:refs/tags/<new_tag> :<old_branch_or_tag>
远程分支重命名/远程标签→分支转换:(注意::refs/heads/
)
git push <remote_name> <old_branch_or_tag>:refs/heads/<new_branch> :<old_branch_or_tag>
输出重命名远程标签:
D:\git.repo>git push gitlab App%2012.1%20v12.1.0.23:refs/tags/App_12.1_v12.1.0.23 :App%2012.1%20v12.1.0.23
Total 0 (delta 0), reused 0 (delta 0)
To https://gitlab.server/project/repository.git
- [deleted] App%2012.1%20v12.1.0.23
* [new tag] App%2012.1%20v12.1.0.23 -> App_12.1_v12.1.0.23