首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >GIT学习----第十五节:Feature分支

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

作者头像
Rattenking
发布2021-01-30 13:07:58
发布2021-01-30 13:07:58
6530
举报
文章被收录于专栏:RattenkingRattenking

学习目的

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

强制删除未合并分支

  1. 建立并切换新功能分支feature-001
代码语言:javascript
复制
$ git checkout -b feature-001
Switched to a new branch 'feature-001'
M       readme.txt
  1. 查看工作区
代码语言:javascript
复制
$ 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")
  1. 提交
代码语言:javascript
复制
$ git add readme.txt

$ git commit -m "测试新功能分支"
[feature-001 6edb4e3] 测试新功能分支
 1 file changed, 2 insertions(+), 3 deletions(-)
  1. 切换回master分支
代码语言:javascript
复制
$ 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)
  1. 突然该功能不要了,并且需要删除该功能分支
代码语言:javascript
复制
$ 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'.
  1. 有提示可看出
代码语言:javascript
复制
$ git branch -D feature-001
Deleted branch feature-001 (was b1f9f41).

总结

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018/11/30 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 学习目的
  • 强制删除未合并分支
  • 总结
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档