用到的新命令
1.git branch -D 分支名:要丢弃一个没有被合并过的分支,可以通过该命令强行删除。
1.新建分支feature
[root@VM_0_11_centos learn_git]# git checkout -b feature
Switched to a new branch 'feature'
2.添加feature.txt文件,add 和 commit
[root@VM_0_11_centos learn_git]# vim feature.txt
[root@VM_0_11_centos learn_git]# git add feature.txt
[root@VM_0_11_centos learn_git]# git status
# On branch feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: feature.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# "q\033"
[root@VM_0_11_centos learn_git]# git commit -m "add feature.txt"
[feature 441816d] add feature.txt
1 file changed, 1 insertion(+)
create mode 100644 feature.txt
3.正常情况下feature分支和bug分支是类似的,合并,然后删除,但现在要消除该分支
[root@VM_0_11_centos learn_git]# git branch -d feature
error: The branch 'feature' is not fully merged.
If you are sure you want to delete it, run 'git branch -D feature'.
<==销毁失败。Git友情提醒,feature分支还没有被合并,如果删除,将丢失掉修改,如果要强行删除,需要使用大写的-D参数。
4.-D 删除成功
[root@VM_0_11_centos learn_git]# git branch -D feature
Deleted branch feature (was 441816d).
[root@VM_0_11_centos learn_git]# git branch
dev
* master
来源:CSDN
作者:ztq小天
链接:https://blog.csdn.net/weixin_38850997/article/details/89517733