# 1. Rename local branch
git checkout old-name
git branch -m new-name # -m, --move Move/rename a branch and the corresponding reflog.
# or
git branch -m old-branch new-name
# 2. Push new branch to remote
git push origin -u new-name # -u, --set-upstream 设置 git pull/status 的上游
# 3. Delete old branch from remote
git push origin --delete old-name
Git Rename Branch
发布时间 2023-04-07 16:37:01作者: shendawei