gitgit-bisect

How do I run git bisect only on commits that changed a certain file?


I have a bug that have been introduced a long time ago, and testing for it is painful. However, I strongly suspect that changes which introduced the bug happened in one particular source code file.

Can I run git bisect on a sub-set of commits that changed that one file?


Solution

  • Yes, you can. In the manpage, you find this line:

    git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>]
          [--no-checkout] [<bad> [<good>...]] [--] [<paths>...]
    

    so after --, you put the paths of the files or directories.

    For example:

    git bisect start -- arch/i386 include/asm-i386