KEMBAR78
Automated debugging with git | PDF
Automated debugging with git
Amit Nijhawan
2
What is git bisect?
●
Use binary search to find the commit that introduced a bug.

So what does that mean?
3
Divider Slide
The basic git bisect workflow
4
Basic bisect commands: start, bad, good
$ git bisect start
$ git bisect bad # Current version is bad
$ git bisect good
5
How to verify good and bad commit using bisect tool?
 First, we need to let git know that we are going to start bisect
procedure:
git bisect start
 Next, we will let git know which commit is bad, if the current commit is
bad, you don't have to specify the hash:
git bisect bad
 Then, we let git know which commit is surely a good one (in this case,
it is the Initial commit, we have to specify the hash)
git bisect good c1417d3
6
 At this point, git start checking and it will let you know how many
remaining commits to check and which commit it is checking now (git
will choose the commit at the middle of your selected range at the
beginning)
Bisecting: 2 revisions left to test after this (roughly 1 step)
[f6ce7408ad0826436c00eb94b7973a965362bc4c] Add container
 Yeah, git automatically checks out the commit Add container. Our job
is run our code and let git know if this commit contains bad code or
not. In our case, this is a bad commit, so we let it know that it is bad.
git bisect bad
7
 Yeah, now git knows this commit is bad, so it does not need to check
all the commits later than this commit. You have just reduced the
search range to a half (binary search)
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[f258f1ce329e4a9dc29bc28e5b03b94838f50333] Add styles
 Let's say that this commit is good, we will run
git bisect good
8
 Git now is able to conclude which is the first bad commit
THANK YOU

Automated debugging with git

  • 1.
    Automated debugging withgit Amit Nijhawan
  • 2.
    2 What is gitbisect? ● Use binary search to find the commit that introduced a bug.  So what does that mean?
  • 3.
    3 Divider Slide The basicgit bisect workflow
  • 4.
    4 Basic bisect commands:start, bad, good $ git bisect start $ git bisect bad # Current version is bad $ git bisect good
  • 5.
    5 How to verifygood and bad commit using bisect tool?  First, we need to let git know that we are going to start bisect procedure: git bisect start  Next, we will let git know which commit is bad, if the current commit is bad, you don't have to specify the hash: git bisect bad  Then, we let git know which commit is surely a good one (in this case, it is the Initial commit, we have to specify the hash) git bisect good c1417d3
  • 6.
    6  At thispoint, git start checking and it will let you know how many remaining commits to check and which commit it is checking now (git will choose the commit at the middle of your selected range at the beginning) Bisecting: 2 revisions left to test after this (roughly 1 step) [f6ce7408ad0826436c00eb94b7973a965362bc4c] Add container  Yeah, git automatically checks out the commit Add container. Our job is run our code and let git know if this commit contains bad code or not. In our case, this is a bad commit, so we let it know that it is bad. git bisect bad
  • 7.
    7  Yeah, nowgit knows this commit is bad, so it does not need to check all the commits later than this commit. You have just reduced the search range to a half (binary search) Bisecting: 0 revisions left to test after this (roughly 0 steps) [f258f1ce329e4a9dc29bc28e5b03b94838f50333] Add styles  Let's say that this commit is good, we will run git bisect good
  • 8.
    8  Git nowis able to conclude which is the first bad commit
  • 9.