您的位置:首页 > 其它

git学习笔记整理-13-分支管理

2017-08-21 19:07 302 查看
$  git branch 不加任何参数可显示所有分支列表

$ git branch
iss53
* master
testing

* 这个符号代表当前检出分支、

git branch -v
 命令可以查看每一个分支的最后一次提交

$ git branch -v
iss53   93b412c fix javascript issue
* master  7a98805 Merge branch 'iss53'
testing 782fd34 add scott to the author list in the readmes


--merged
 与 
--no-merged
 这两个有用的选项可以过滤这个列表中已经合并或尚未合并到当前分支的分支。
如果要查看哪些分支已经合并到当前分支,可以运行 
git branch --merged:


$
git branch --merged  iss53* master


查看所有包含未合并工作的分支,可以运行 
git
branch --no-merged


$ git branch --no-merged  testing

尝试使用 
git branch -d
 命令删除它时会失败:

$ git branch -d testing
error: The branch 'testing' is not fully merged.
If you are sure you want to delete it, run 'git branch -D testing'.


如果真的想要删除分支并丢掉那些工作,如同帮助信息里所指出的,可以使用 
-D
 选项强制删除它。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: