Jandaweb

On git bisect being awesome for CSS debugging

By Andrew Bruce on Wednesday 25th March 12:45 AM

Whilst developing our upcoming http://besimplyagile.com/ I have found a return (from a certain employer's Subversion infection) to Git to be very refreshing.

I'd managed to introduce a bug in some CSS and JavaScript that would have taken a good while to track down with other tools. This is all it took:

git start
git bad (marks the current version as having the bug)
git good e854ie (marks the commit with the given hash that you know didn't have the bug)
git bad
refresh browser
git bad
refresh browser
git good (i.e. the bug isn't there)
refresh browser

...and so on. This proves to be a super quick method of tracking front-end bugs. After you've answered a few good / bads git will have found the problem commit in less time than it would have taken you on your own. After that, it's just a case of diffing the previous commit and you're more than likely staring the bug in the face.

« Back to list