GIT学习----第十五节:Feature分支

学习目的

  1. 如何对未进行合并的分支进行强制删除?

强制删除未合并分支

  1. 建立并切换新功能分支feature-001

    1
    2
    3
    $ git checkout -b feature-001
    Switched to a new branch 'feature-001'
    M readme.txt
  2. 查看工作区

    1
    2
    3
    4
    5
    6
    7
    8
    9
    $ git status
    On branch feature-001
    Changes not staged for commit:
    (use "git add <file>..." to update what will be committed)
    (use "git checkout -- <file>..." to discard changes in working directory)

    modified: readme.txt

    no changes added to commit (use "git add" and/or "git commit -a")
  3. 提交

    1
    2
    3
    4
    5
    $ git add readme.txt

    $ git commit -m "测试新功能分支"
    [feature-001 6edb4e3] 测试新功能分支
    1 file changed, 2 insertions(+), 3 deletions(-)
  4. 切换回master分支

    1
    2
    3
    4
    $ git checkout master
    Switched to branch 'master'
    Your branch is ahead of 'origin/master' by 13 commits.
    (use "git push" to publish your local commits)
  5. 突然该功能不要了,并且需要删除该功能分支

    1
    2
    3
    $ git branch -d feature-001
    error: The branch 'feature-001' is not fully merged.
    If you are sure you want to delete it, run 'git branch -D feature-001'.
  6. 有提示可看出

    1
    2
    $ git branch -D feature-001
    Deleted branch feature-001 (was b1f9f41).

总结

  1. 新功能和bug修复一样,都需要进行创建新的分支进行处理;
  2. 当没有合并分支要删除分支的时候采用强制删除分支:git branch -D

其他

QQ交流群: 264303060

QQ交流群

我的博客,欢迎交流!

我的CSDN博客,欢迎交流!

微信小程序专栏

前端笔记专栏

微信小程序实现部分高德地图功能的DEMO下载

微信小程序实现MUI的部分效果的DEMO下载

微信小程序实现MUI的GIT项目地址

微信小程序实例列表

前端笔记列表

游戏列表