Automatically Locate When and Where Bugs Were Introduced with git bisect

git bisect start
git bisect bad
git checkout $(git rev-list --max-age=2016–06–03 --date-order --reverse HEAD | head -n 1)
git bisect good
Bisecting: 987 revisions left to test after this (roughly 10 steps)
[8fe7a35242303e8316c1d77883c0e247db6df5a8] testDefaultTotalCountIsZero
Bisecting: 489 revisions left to test after this (roughly 9 steps)
[03c4c4e5bd1740a277a606dd208e17a855761243] Merge branch 'release/1.5' of https://github.com/elliotchance/concise into 1.4/193-set-color-scheme
57a00e86622073c887be101a2e76c079245e519c is the first bad commit
git show 57a00e8
git diff 57a00e8 57a00e8^
git bisect reset

Gotchas

For Lazy People

git bisect run phpunit --filter testRecordIsSavedToTheDatabase

--

--

--

I’m a data nerd and TDD enthusiast originally from Sydney. Currently working for Uber in New York. My thoughts here are my own. 🤓 elliotchance@gmail.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Elliot Chance

Elliot Chance

I’m a data nerd and TDD enthusiast originally from Sydney. Currently working for Uber in New York. My thoughts here are my own. 🤓 elliotchance@gmail.com

More from Medium

PostgreSQL and typeorm — Getting a local Postgres instance

Git Advanced Topics Part One

What is JWT

Tracking queries with knex-mock — mocking database transactions with multiple queries