🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* 创建本地分支 [root@linux7-node3 shell-code]# git branch Dev * 切换到该Dev分支 [root@linux7-node3 shell-code]# git branch -d DeV * 远程没有有Dev分支并,本地已经切换到Dev [root@linux7-node3 shell-code]# git push origin Dev:Dev Username for 'https://github.com': 851628816@qq.com Password for 'https://851628816@qq.com@github.com': Total 0 (delta 0), reused 0 (delta 0) To https://github.com/xionghaihua/shell-code.git * [new branch] Dev -> Dev [root@linux7-node3 shell-code]# git branch -a * Dev master remotes/origin/Dev 第二种情况:远程仓库有Dev分支,但是尚未关联本地的Dev分支 git checkout Dev git push -u origin/Dev (本地Dev和远程Dev建立关联) * 当本地删除了Dev分支,基于远程分支origin/Dev创建一个本地分支 ~~~ [root@linux7-node3 shell-code]# git checkout master Switched to branch 'master' Your branch is up-to-date with 'origin/master'. [root@linux7-node3 shell-code]# git branch -d Dev Deleted branch Dev (was 2d04606). [root@linux7-node3 shell-code]# git branch -a * master remotes/origin/Dev remotes/origin/HEAD -> origin/master remotes/origin/master [root@linux7-node3 shell-code]# git checkout -b Dev origin/Dev Branch Dev set up to track remote branch Dev from origin. Switched to a new branch 'Dev' [root@linux7-node3 shell-code]# git branch -a * Dev master remotes/origin/Dev remotes/origin/HEAD -> origin/master remotes/origin/master ~~~ * 删除远程分支 [root@linux7-node3 shell-code]# git push origin :Dev