Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    $ git bisect start
    $ git bisect good <sha>
    $ git bisect bad master
    git will do all the hard work for you. You just have to run your tests at each point that git prompts you, and tell it whether it passed or not:
    $ git bisect bad (or good)
Props to the author for describing 'git bisect', which is a big time saver; but I'm always surprised that articles like this don't go on to mention the even more amazing 'git bisect run', which automates the "run your tests at each point and tell it whether it passed" part:

    $ git bisect start
    $ git bisect good <sha>
    $ git bisect bad master
    $ git bisect run rspec spec/path/to/failing_spec.rb
    ... wait a bit ...
    5243cafebabe is the last bad commit
You can give it any shell command, and it'll automatically bisect, run the command, mark the current commit as good or bad depending on the shell return code of the command, then bisect again, etc.

It's right there in the man page, but for some reason seems to be little known (or at least talked about).



I suppose automating this is not too difficult. Something like:

    $ git bisect start --good <sha> --run rspec spec/path/to/failing_spec.rb
    ... wait longer ...
    5243cafebabe is the last bad commit




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: