如何从Linux内核git树中正确选择有问题的提交

背景

Linux内核版本4.12及更高版本开始,我的设备无法正常工作.我想找出哪个特定的提交导致了问题.我当前的流程是:

>在here查看Linux内核提交日志
>单击单个提交,复制提交ID
>运行git checkout< commit id>
>重新配置内核make menuconfig,然后重新编译make -j32
>在我的设备上安装内核,确认问题是否仍然存在
>否则,请缩小提交范围,然后返回步骤1

问题

当我经历这个繁琐的过程时,我发现编译后的内核版本是不同的(您也可以通过阅读Makefile进行查看).但是,我看不到通过Linux内核提交日志进行的版本更改.实际上,在尝试git diff< first commit id>之后, <第二提交ID&gt ;,根据步骤1中的Linux内核提交日志,第二个提交ID是第一个提交ID后面的1个提交,发现存在未反映在网站上的更改. 题 为什么会这样呢?如何正确找出导致设备出现问题的特定提交?

解决方法:

为了正确找出导致您的设备出现问题的提交,您应该使用git bisect.它可以自动执行您手动执行的工作流程.请参阅文档here.

This command uses a binary search algorithm to find which commit in
your project’s history introduced a bug. You use it by first telling
it a “bad” commit that is known to contain the bug, and a “good”
commit that is known to be before the bug was introduced. Then git
bisect picks a commit between those two endpoints and asks you whether
the selected commit is “good” or “bad”. It continues narrowing down
the range until it finds the exact commit that introduced the change.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐