A Real 'git bisect' Session
Learn about git bisect by implementing an example.
Now that you understand a bisect session, you’re going to embed this idea by running through an actual git bisect
session. If the previous lesson felt a bit abstract, then this might help make the lesson more vivid.
Requirements
What you’re going to do is create a Git repository with one file (projectfile
). In this file, you are going to add a line for each commit. The first line will be 1
, the second 2
, and so on until the hundredth commit, which adds the line 100
.
In this scenario, the “bug” is the line 63
, but you don’t know that yet. All you know is that you can tell if the bug is in the code with this shell command:
if grep -w 63 projectfile
> then
> echo BAD
> else
> echo GOOD
...