Git-命令-新建,删除本地和远程分支,更改本地和远程分支的名称

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/alnorthword/article/details/100013555

查看项目的分支们(包括本地和远程)

// 全部分支
$ git branch -a

// 本地分支
$ git branch

删除本地分支

$ git branch -d <BranchName>

删除远程分支

$ git push origin --delete <BranchName>

本地创建新分支并切换到新分支

$ git checkout -b feat/xxx-xxx

将此分支推送至远程分支(此时本地分支与远程分支名称相同)

$ git push origin feat/xxx-xxx:feat/xxx-xxx

更改本地和远程分支的名称

//  Rename branch locally 
$ git branch -m old_branch new_branch
 // Delete the old branch 
$ git push origin :old_branch
 // Push the new branch, set local branch to track the new remote
$ git push --set-upstream origin new_branch 

猜你喜欢

转载自blog.csdn.net/alnorthword/article/details/100013555
今日推荐