先拉取old_branch最新代码到本地

1
2
3
git checkout old_branch

git pull origin old_branch

本地修改后并推送

1
2
3
4
5
# 修改分支名称
git branch -m old_branch new_branch

# 删除在远程的老分支
git push --delete origin old_branch

推送新分支

1
git push origin new_branch

本地分支与远程分支相连

1
git branch --set-upstream-to origin/new_branch