步骤就是:删除远程分支(你要修改名称的分支)
修改本地分支的名称,然后将本地分支推送至远程。
举了例子:
当前的情况:
远程分支:feature/develop/today1
本地分支: feature/develop/today1
需求是将远程分支feature/develop/today1名称改为feature/develop/today2
下面就是具体的步骤,:
1、先删除远程分支feature/develop/today1:git push --delete origin/feature/develop/today1
2、修改本地分支名称为:feature/develop/today2。不管你本地是不是在分支feature/develop/today1上,你都可以运行以下命令:
git branch -m feature/develop/today1 feature/develop/today2
上面的命令即是将本地分支feature/develop/today1改为feature/develop/today2
3、将分支feature/develop/today2推送至远程仓库
git push origin feature/develop/today2
此步骤却被你本地已经切换到分支feature/develop/today2。