Binary lookup in git (git BISECT)

Source: Internet
Author: User
Tags using git
Git-managed code warehouse, if you find new bugs introduced, you can use "Git bisect" to do a binary search, to locate is to introduce a bug commit. This is especially common in open source communities such as Linux, KVM, and QEMU.
When a bug is fixed, you can also use "Git bisect" to find a commit to fix the bug in two points. However, since "Git Bisect" was originally used to find the bad point of introducing a bug rather than a fix bug, when using Git bisect to find the point to fix the bug, you might encounter a git worker with the following error message:

[Root@jay-linux qemu.git]# git bisect start# commit-4b274b160 is newer than commit-079944e6. [Root@jay-linux qemu.git]# git bisect good 4b274b160[root@jay-linux qemu.git]# git bisect bad 079944e6some good revs is n OT ancestor of the rev.git bisect cannot work properly in this case. Maybe mistake good and bad revs?

In this case, it can be a different way of thinking, since "Git bisect" only applies to the newer commit as bad, and the older mark as good, then we can "mark the point we think is good as bad, the bad point marked as good", Then find the last "first bad commit" that actually seems to fix a bug "The first good commit".
Really, a little change of thinking can solve this problem, once again realize the importance of "Think out of the box".

Here's an example of what "git bisect" is used to illustrate: Qemu.git.

[Root@jay-linux qemu.git]# git bisect resetalready on ' master ' [root@jay-linux qemu.git]# git bisect start[root@jay-linux qemu.git]# git bisect good 079944e6[root@jay-linux qemu.git]# git bisect bad 4b274b16bisecting:55 revisions left to test After this (roughly 6 steps) [83F58E570F21C3E7227E7FBEF1FC0E18B5ED7EA9] rtl8139:preserve link state across device reset[r Oot@jay-linux qemu.git]# git bisect goodbisecting:27 revisions left-to-test after this (roughly 5 steps) [4a4343671e183824 A3F5DB76AD561CE01E6C6E0A] Usb/ehci:move capsbase and opregbase into Sysbus ehci class[root@jay-linux qemu.git]# git bisec T goodbisecting:13 revisions left-to-test after this (roughly 4 steps) [507066F8A9610C0088DF19CE7B3E436F43165EC1] Qdev:in Clude Qdev code into *-user, Too[root@jay-linux qemu.git]# git bisect badbisecting:8 revisions left-to-test after this (r oughly 3 steps) [c3dd94b129e222e00a4ed00689e11afdd85c740f] Merge remote-tracking branch ' stefanha/net ' into staging[ Root@jay-linux qemu.git]# git bisECT Goodbisecting:4 revisions left-to-test after this (roughly 2 steps) [89eb147c2cfd2c797d3662aa2f55254441f0595a] Uhci:s Top using portio lists[root@jay-linux qemu.git]# git bisect badbisecting:1 revision left-to-test after this (roughly 1st EP) [358d615b6908b4916c74819ffad823cb4a74314e] exynos4210:add EHCI support[root@jay-linux qemu.git]# git bisect badbisecting:0 revisions left-to-test after this (roughly 0 steps) [aee7499a59d6778c10b018da41db4a22655ef8a8] Usb/ehci:ad D sysbus EHCI device for exynos4210[root@jay-linux qemu.git]# git bisect badaee7499a59d6778c10b018da41db4a22655ef8a8 are t He first bad Commitcommit Aee7499a59d6778c10b018da41db4a22655ef8a8author:jay <just for Fun>date:sun Dec 16 04:49  : +0100### just for testing. # # #: 040000 040000 a9ea5da3b5b85d86701f78608405504e9a4de905 0bb166863c84186202c639aff92dd326f1021d42 M HW
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.