git 重命名本地和远程分支

版权声明:本文为博主原创文章,未经允许也可以任意转载。http://huyouxiao.com https://blog.csdn.net/fudaxing/article/details/89468984

不能直接重命名远程分支,只有先删旧的,再推新的。

# Rename the local branch to the new name
git branch -m <old_name> <new_name>

# Delete the old branch on remote - where <remote> is, for example, origin
git push <remote> --delete old_name

# Push the new branch to remote
git push <remote> new_name

# Reset the upstream branch for the new_name local branch
git push <remote> -u new-name

猜你喜欢

转载自blog.csdn.net/fudaxing/article/details/89468984