Git Bisect — How to track down a broken commit

Christian Walter
ITNEXT
Published in
4 min readMay 4, 2020

--

From time to time — it happens: Someone broke the master branch. Depending on the project size, regression testing can be very hard and exhausting. And after a couple of merged commits one does notice that one of the last 50 commits did introduce a regression and the upstream master branch is broken.

Finding this commit which introduced the regression is hard and exhausting if you do it by hand e.g. test one commit after another. This might be something you can do if you have, let’s say five commits between a known working configuration and not working configuration. You just go through the commits one by one and check if the error is already there or not. But what can you do if there are.. 50, 100 or 500 commits between a working and not-working commit?

git bisect for the rescue!

Git

I guess every developer should know git by now. If not: I wrote two articles about git you might want to check out first :

and

--

--

Writer for

Firmware Developer, Tech Enthusiasts. If you have questions about firmware — write me to christian.walter@9elements.com