删除不需要的分支

删除不需要的分支

十月 21, 2019

删除不需要的分支

$ git branch -av #查看分支 假设我们不需要temp分支
fix_add fd98d3d Add add file
fix_add1 2241da2 Add "!"
* master 4b6999e create folder and file
temp 543c5d8 add test
$ git branch -d temp #删除temp分支 会提示我temp还没有合并 如果真的要删除使用-D
error: The branch 'temp' is not fully merged.
If you are sure you want to delete it, run 'git branch -D temp'.
$ git merge temp #或者进行merge 这里产生了冲突 master上我rename了readme
CONFLICT (modify/delete): readme deleted in HEAD and modified in temp. Version temp of readme left in tree.
Automatic merge failed; fix conflicts and then commit the result.
$ git commit -m 'merge branch temp' #解决冲突后提交合并
[master 5524853] merge branch temp
$ git branch -d temp #这时候再使用-d就可以删除了
Deleted branch temp (was 543c5d8).
$ git branch -av
fix_add fd98d3d Add add file
fix_add1 2241da2 Add "!"
* master 5524853 merge branch temp