拉取远程分支并提交到新的远程分支

拉取远程分支到本地目录
git clone <repository_url> -b <remote_branch_name> <local_dir_name>
此时本地目录的分支名与拉取的远程分支名一样

修改本地分支名
git branch -avv
git branch -m <local_branch_name> <new_local_branch_name>

提交到新的远程分支
git push -u origin <local_branch_name>:<new_local_branch_name>

关联远程分支
git branch --set-upstream-to=origin/<remote_new_branch> <local_branch>

猜你喜欢

转载自blog.csdn.net/zhifeng172/article/details/80496514