How do you get git bisect to ignore merged branches?

后端 未结 10 1227
长情又很酷
长情又很酷 2020-12-04 14:26

I\'m aware that git bisect is branch-aware by design, so that if between good commit, G, and bad commit, B, you merged in a branch, it needs to take those changes into consi

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 15:07

    Is there any way of doing --first-parent with git bisect

    Yes: with Git 2.29 (Q4 2020), "git bisect"(man) learns the "--first-parent" option to find the first breakage along the first-parent chain.

    See commit ad464a4, commit e8861ff, commit be5fe20, commit 0fe305a, commit 15a4802 (07 Aug 2020) by Aaron Lipman (alipman88).
    (Merged by Junio C Hamano -- gitster -- in commit 47f0f94, 17 Aug 2020)

    bisect: introduce first-parent flag

    Signed-off-by: Aaron Lipman

    Upon seeing a merge commit when bisecting, this option may be used to follow only the first parent.

    In detecting regressions introduced through the merging of a branch, the merge commit will be identified as introduction of the bug and its ancestors will be ignored.

    This option is particularly useful in avoiding false positives when a merged branch contained broken or non-buildable commits, but the merge itself was OK.

    git bisect [--no-checkout] [--first-parent] [ [...]] [--] [...]
    

    git bisect now includes in its man page:

    --first-parent

    Follow only the first parent commit upon seeing a merge commit.

    In detecting regressions introduced through the merging of a branch, the merge commit will be identified as introduction of the bug and its ancestors will be ignored.

    This option is particularly useful in avoiding false positives when a merged branch contained broken or non-buildable commits, but the merge itself was OK.

提交回复
热议问题