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 subset of commits that changed that one file?


Solution

  • Yes, you can. In the man page, 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