Git Rename Branch

# 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
posted @ 2023-04-07 16:32  shendawei  阅读(111)  评论(0编辑  收藏  举报