Recently I’ve come across a couple dev issues that were incredibly difficult to track down.
Normally, fixing a bug in JavaScript is as simple as r...
For further actions, you may consider blocking this person and/or reporting abuse
git bisect
is a life saver! It has saved my bacon several times. If you have automated tests, you can even run bisect on autopilot, if the test has a 0 exit status, it treats it as good, if it has a non-zero exit status, it treats it as bad. Just start it, go get some coffee, and come back to find your bad commit!see here for more details: lwn.net/Articles/317154/
Neat! Thanks for sharing.
It seems like if you're using a continuous integration model though where your tests are always running on each commit, and it's required that your tests pass before you're allowed to merge your new code into the master branch, you wouldn't end up in a situation in which you have failing tests on your master branch. Right?
So is automating
git bisect
assuming that you're not enforcing 100% passing tests? Or would you run it on your own branch in which you have multiple commits that haven't had their tests validated and you've introduced a bug somewhere in there, but you still haven't merged to master yet? Or what's the use case here?That's a good point.
I think the use case would be if you uncover a bug that you don't have an automated test for, but you can then write one that reproduces the bug. Then you run git bisect in automatic mode. Once the issue is fixed, you can add that new test to your test suite. 🤷♂️That's the best one I can think of.
Ooh didn't know about
git bisect run
.Wouldn't that be too slow for web apps that have no compilation step?
Love this article Tyler, thanks! You gave me an idea about using
rspec bisect
to track down bugs in Rails tests :-)Thank you! Glad you liked it.
Great explanation Tyler!
Damn. This was actually mindblowing! Thanks for sharing!
You’re welcome! Glad you enjoyed it.
Thanks for the great description Tyler. I had no idea how git bisect was used. It looks quite useful.
You're welcome! Thanks for reading.
I come back to this post over and over and over again. Good reference guide to something I use often. Thanks!
No prob!