SlideShare a Scribd company logo
1 of 9
Download to read offline
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

More Related Content

Similar to Automated debugging with git

Similar to Automated debugging with git (20)

JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
Git It
Git ItGit It
Git It
 
Git github
Git githubGit github
Git github
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Git
GitGit
Git
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
Introduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control systemIntroduction to git, an efficient distributed version control system
Introduction to git, an efficient distributed version control system
 
Version control, you git
Version control, you gitVersion control, you git
Version control, you git
 
Git for Beginners
Git for BeginnersGit for Beginners
Git for Beginners
 
Hello git - a soft introduction to git (Talk Slides)
Hello git - a soft introduction to git (Talk Slides) Hello git - a soft introduction to git (Talk Slides)
Hello git - a soft introduction to git (Talk Slides)
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Managing releases effectively through git
Managing releases effectively through gitManaging releases effectively through git
Managing releases effectively through git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Git for Writers: Dumping the Bucket Metaphor
Git for Writers: Dumping the Bucket MetaphorGit for Writers: Dumping the Bucket Metaphor
Git for Writers: Dumping the Bucket Metaphor
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Git-r-Done
Git-r-DoneGit-r-Done
Git-r-Done
 
Getting Started with Git
Getting Started with GitGetting Started with Git
Getting Started with Git
 

Recently uploaded

School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
Kamal Acharya
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
Kamal Acharya
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
MohammadAliNayeem
 

Recently uploaded (20)

ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Artificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian ReasoningArtificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian Reasoning
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Teachers record management system project report..pdf
Teachers record management system project report..pdfTeachers record management system project report..pdf
Teachers record management system project report..pdf
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWINGBRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
Quiz application system project report..pdf
Quiz application system project report..pdfQuiz application system project report..pdf
Quiz application system project report..pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 

Automated debugging with git

  • 1. Automated debugging with git Amit Nijhawan
  • 2. 2 What is git bisect? ● Use binary search to find the commit that introduced a bug.  So what does that mean?
  • 3. 3 Divider Slide The basic git 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 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. 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. 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. 8  Git now is able to conclude which is the first bad commit