GIT学习----第十四节:BUG分支
2023-09-14 09:15:08 时间
学习目的
- 遇到临时bug需要紧急修复,在git如何处理?
- git如何进行工作区进行储藏,等待bug修复后的工作区恢复?
临时储藏
- 修改后查看工作区状态
$ git status
On branch master
Your branch is ahead of 'origin/master' by 10 commits.
(use "git push" to publish your local commits)
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")
- 临时存储git stash
$ git stash
Saved working directory and index state WIP on master: 118be5d --no-ff模式合并
- 查看工作区
$ git status
On branch master
Your branch is ahead of 'origin/master' by 10 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
- 新建bug分支’issue-001’
$ git checkout -b issue-001
Switched to a new branch 'issue-001'
- 修改文件查看,添加’bug分支测试!’
$ cat readme.txt
Git is a version control system.
Git is free software.
Git is a distributed version control system.
Git is free software.
添加一行测试工作区、暂存区、分支。
cat 命令测试。
测试修改文件后各区状态!
测试git diff,查看工作区和分支文件的修改情况!
再次测试git diff对比工作区和版本库最新版本的区别。
测试撤销修改!
Creating a new branch is quick and simple.
测试分支合并冲突!
分支管理测试!
测试fast forward合并模式!
测试--no-ff合并模式!
bug分支测试!
- bug分支提交
$ git add readme.txt
$ git commit -m "bug分支测试提交"
[issue-001 991a531] bug分支测试提交
1 file changed, 3 insertions(+), 1 deletion(-)
- 切换到master分支,合并issue-001分支,删除issue-001分支
$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 10 commits.
(use "git push" to publish your local commits)
$ git merge --no-ff -m "bug分支测试合并" issue-001
Merge made by the 'recursive' strategy.
readme.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
$ git branch -d issue-001
Deleted branch issue-001 (was 991a531).
- 查看工作区,查看现场储藏区,恢复储藏文件,再查看工作区
查看工作区
$ git status
On branch master
Your branch is ahead of 'origin/master' by 12 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
查看现场储藏区
$ git stash list
stash@{0}: WIP on master: 118be5d --no-ff模式合并
恢复储藏文件
$ git stash pop
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
再查看工作区
$ git status
On branch master
Your branch is ahead of 'origin/master' by 12 commits.
(use "git push" to publish your local commits)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: readme.txt
no changes added to commit (use "git add" and/or "git commit -a")
总结
- 正在工作区工作,突然进行紧急bug修复,储藏现场git stash;
- 新建bug分支,进行修复bug,提交修复,切换到master,合并bug分支,删除bug分支。
- 恢复工作区git stash pop(简写命令)。查看储藏列表git stash list;恢复储藏git stash apply;删除储藏git stash drop。
其他
QQ交流群: 264303060
相关文章
- Bug:StampedLock的中断问题导致CPU爆满
- 总结这两天连续干掉的bug In 创新实训 智能自然语言交流系
- [Git] git代码统计
- [Git] Git fetch和git pull的区别
- [Git] git merge之squash
- [Git] git shortlog 找出最懒的程序员
- Bug避障算法简介
- Git 代码更新:git fetch 和 git pull 的区别
- [廖雪峰] Git 分支管理(2):Bug 分支
- iOS开发之Bug(持续更新)
- 【RAC】在所有节点上滚动安装BUNDLE Patch for Base Bug 9413827补丁包
- 【MySql】innobackupex 增量备份的bug
- [git]Git与Repo入门
- [git/svn]Git和SVN差异
- git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).
- 疑似BUG:Python SGMLParser处理html中的javascript失当
- 给RelativeLayout设置背景,无效果bug解决
- 【刷题】游戏测试常见Bug
- [Practical Git] Configure global settings with git config
- 【学习总结】Git学习-GIT工作流-千峰教育(来自B站)
- [Git] git Ignore a File that has Already been Committed and Pushed
- 上午在改BUG,下午就通知被裁了
- atitit.java给属性赋值方法总结and BeanUtils 1.6.1 .copyProperty的bug
- 【习题 5-9 UVA - 1596】Bug Hunt
- CSDN粉丝解答:六月份第一期精选——互联网笔试编程解决、简单bug处理、编程系统设计等
- Java编程中忽略这些细节,Bug肯定找上你
- 线上紧急问题,如宕机、卡顿、bug等,如何快速反应和解决,具体解决方案
- git-【七】bug分支
- 软件测试完后,还有BUG,是测试人员的问题吗?
- Git知识总览(四) git分支管理之rebase 以及 cherry-pick相关操作
- Git 管理工具 SourceTree 的使用(上手简单,不熟悉git命令的开发者必用)
- git分支创建、分支合并,分支删除(删除本地分支和删除远程分支)分支管理、bug分支,版本分支,测试分支等等---超详细图文教程(小白一看就会,不用害怕)
- 【Bug解决】8080端口已被使用