How could I use git bisect to find the first GOOD commit?

后端 未结 5 1359
清酒与你
清酒与你 2020-12-22 23:05

I have the following problem:

  • the version at master works fine
  • the version of the last tag before master (say last
5条回答
  •  抹茶落季
    2020-12-22 23:58

    If you're using git bisect run like I have been doing with Perl's prove command (which runs automatic tests) you have no chance just to swap good and bad. The success of the tests will be reported as exit code.

    I have found a valid Bash syntax to negate the exit code of the program run by git bisect run:

    git bisect start
    git bisect bad HEAD                 # last revision known to PASS the tests
    git bisect good $LAST_FAIL_REVISION # last revision known to FAIL the tests
    git bisect run bash -c "! prove"
    

    This gave me the first revision to pass the tests run by prove.

提交回复
热议问题