作者:雷神天在飘雪_804_959 | 来源:互联网 | 2023-09-11 10:24
一、问题前言:
gitLab上可以看到多了新建的分支subbranch
![](https://img1.php1.cn/3cd4a/2513d/525/87983203c9575480.png)
Git Bash Here上面:
![](https://img1.php1.cn/3cd4a/2513d/525/0930596411386779.png)
二、解决办法
查看分支
git branch
切换分支
git checkout 分支名
新建分支
git branch 分支名
合并某分支到当前分支
git merge 分支名
删除分支
git branch -D 分支名
删除git工具(比如码云上的)上的分支
git push origin --delete 分支名
创建分支并切换到该分支
git checkout -b 新建分支名
注意:
1.博客上面你看到的代码不一定是对的,你得去验证比如,有的人就把 (git push origin --delete 分支名 )错误写成(git push --delete origin 分支名),提示没有这个命令,如下图:
![](https://img1.php1.cn/3cd4a/2513d/525/d5d9041b53145cca.png)