[Practical Git] Diagnose which commit broke something with git bisect
Sometimes you find a bug in your project that has been around for a while without being noticed; it can be hard to track down where that bug was introduced and why just by searching through logs and diffs. Git has a slick tool called git bisect
that can be used to find out which commit introduced problem in our code - it creates a binary search where the programmer can mark each search commit as good
or bad
; by the end of the bisect, Git shows you exactly which commit introduced the issue. In this lesson, we walk through an example of using git bisect
from start to finish.
To get started:
git bisect start
First, we need to find out which commit cause the problem, now assume it is the lastest commit, so we need to mark it as 'bad':
git bisect bad
Then , we need to find out which commit works fine, then mark it as good:
git log --oneline // to pick one which you are sure code works fine # Then get the commit id git bisect good <commit_id>
Then git will show you the commits which stay between the bad and good commits and will automatically checkout the next commit. Then you can do the testing and find out whether this commit is bad or not, if it is bad then mark as 'bad' or the other way around.
Finnally git bisect will find out the bad commit which introduce the bugs, but we are still in the bisecting state, to back to normal, we need to run:
git bisect reset
[Practical Git] Diagnose which commit broke something with git bisect的更多相关文章
- [原]git的使用(一)---建立本地仓库、add和commit、status和git diff、版本回退使用git reset
在window下已经安装了git的环境 1.建立本地仓库 mkdir test #建立test目录 cd test #进入目录 git init # ...
- Git error on commit after merge - fatal: cannot do a partial commit during a merge
Git error on commit after merge - fatal: cannot do a partial commit during a merge this answer is : ...
- 第二章-如何使用github建立一个HelloWorld项目,git的add/commit/push/pull/fetch/clone等基本命令用法。--答题人:杨宇杰
1.配置Git 首先在本地创建ssh 秘钥:在git bash输入: $ ssh-keygen -t rsa -C "your_email@youremail.com" eg:$ ...
- 第二章——建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别-----答题者:徐潇瑞
1.首先下载安装git,很简单所以就不详细说了,当弹出一个类似的命令窗口的东西,就说明Git安装成功 2.因为Git是分布式版本控制系统,所以需要填写用户名和邮箱作为一个标识 3.接着,注册githu ...
- 通过git rebase修改commit message
今天发现一个项目的git commit message中的单词拼错了,需要修改一下.但这样简单的修改,需要通过git rebase才能完成. 首先要git rebase到需要修改message的那个c ...
- Git 版本退回commit
有的时候错误提交了commit,需要版本退回. 先用git log查看一下节点版本号commit_id $ git log 再用git reset退回 $ git reset -soft commit ...
- commit lint规范化团队git提交信息
一.快速提交符号angular编码规范的提交信息 1.命令行中安装commitizen: npm install -g commitizen commitizen init cz-convention ...
- Need help with git commit - Error : "error: cannot run gpg: No such file or directory error: could not run gpg. fatal: failed to write commit object"support (self.git)
参考:https://www.reddit.com/r/git/comments/4jflp1/need_help_with_git_commit_error_error_cannot_run/ It ...
- Git 合并多次 commit 、 删除某次 commit
Git 合并多次 commit 有时候在一个分支的多次意义相近的 commit,会把整个提交历史搞得很混乱,此时可以将一部分的 commit 合并为一个 commit,以美化整个 commit 历史, ...
随机推荐
- jquery自动焦点图
效果预览:http://runjs.cn/detail/vydinibc 带左右箭头的自动焦点图:http://runjs.cn/detail/wr1d1keh html: <div clas ...
- WCF:为 SharePoint 2010 Business Connectivity Services 构建 WCF Web 服务(第 1 部分,共 4 部分)
转:http://msdn.microsoft.com/zh-cn/library/gg318615.aspx 摘要:通过此系列文章(共四部分)了解如何在 Microsoft SharePoint F ...
- 多线程与网络之JSON和XML数据的解析
*:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...
- js中的new关键字都干了些什么?
new 操作符 在有上面的基础概念的介绍之后,在加上new操作符,我们就能完成传统面向对象的class + new的方式创建对象,在javascript中,我们将这类方式成为Pseudoclassic ...
- log4net使用的一点心得
关于使用log4net的文章很多,把自己在使用中查到的文章列一下. log4net 可以存在很多地方 比如console,数据库.邮箱.文本等等.我要实现的是 所有的日志都记录到html文件中,可以按 ...
- curl命令学习(转载的)
原文地址: http://www.thegeekstuff.com/2012/04/curl-examples/ curl是网络上常用一个命令,简单来说就是可以上传下载,甚至可以当成下载工具使用,比如 ...
- Good practice release jar to Nexus
Step suppose you need to develop a feature,when you finish the feature ,you need to release the jar ...
- 广州大学华软软件学院——NA视频下载
准备工具: 360极速浏览器(不要认错图标了): 浏览器视频下载插件: 第一步:安装浏览器插件 1.打开浏览器 2.解压,找到插件文件: 3.把插件拖到浏览器中: 4.添加,然后就完成了插件安装 查看 ...
- leetcode@ [241] Different Ways to Add Parentheses (Divide and Conquer)
https://leetcode.com/problems/different-ways-to-add-parentheses/ Given a string of numbers and opera ...
- ant -verbose -debug ...
ant -verbose -debug (target) 可以让ant打印出所执行的command任务