brewly — Ch.9 · Hunt a bug with bisect
Exercise 5 of 5
Before you start
Binary search through history
You know a version that worked and one that does not. git bisect checks out a commit halfway between them; you test it and say good or bad; it halves again. Nine commits take three or four tests.
Press "Run tests" to test whatever is checked out. Then tell git the result.
When it names the first bad commit, note its message, return with reset, and revert that commit.
- git bisect start
- begin
- git bisect bad
- the version checked out is broken
- git bisect good <tag>
- this version worked
- git bisect good
- the version checked out works
- git bisect reset
- go back to your branch
- git log --oneline
- find the commit again
- git revert <commit>
- undo it
You can reopen this any time with “Lesson”.
# BrewlyOrder coffee ahead.## Team- Maya (lead)- Alex (frontend)
Graph
- a3d30b1 Remember favouritesHEAD → main
- b55d3fb Show a badge
- 12c2b98 Add loyalty stamps
- 24b2497 Simplify the total
- 8e9227e Add gift cards
- 8691c3a Print receipts
- 79de41b Suggest tips
- 9cf33a8 List allergens
- dfdfc29 Add opening hours
- 1354d06 Add menu pagetag: v1.0.0origin/main
- 619eb3b Style the order button
- 5fc44ac Initial commit