Find faulty commits in your git repository | git bisect

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you're working on a project there's always the challenge of finding the commit that caused the bug if you're using gits on that project you can use the bicep command to find the commit that caused the bug in this tutorial i'll show you how to use the bisect command to find batch limits in a project so let's get started [Music] okay i've already created a bunch of commits in my repository and add two aliases to the git config file one for git log and one for git show just to make their output look nicer so git can fix this global dash e as you see these are the aliases that i have added to the git config file for you and if i check the logs using them to show the commits so git lol as you can see we have four commands in our repository and in this commit um as you can see the commit has changed number two and a bug so this is the bad commit but imagine we don't know that yet so let's use the bisect command to find the bat commit the bisect command is pretty simple first you need to tell git to insert the bisect operation to do that type kit bisect start as you can see my terminal is showing me that the bisect command is working so the second step is to tell git which commit is a bad commit to do that type git bisect bat then specify the bad commit if you don't specify the bad community you will consider the hit commit as a bad one so if you change your head to point to another commit then run git bisect bat you'll tell git that the new head is a bad commit and i'm on the last committee which has the bug look cat main text see the current head has the book so i mark this commit as a bad commit so git bisect bat after you specified the bat commit you can tell git which commit is a good commit and to do that type git bisect good then you can specify a good commit and just like the bad commit if you don't specify the good commit here it will consider the head commit as a good one and the first commit was good i think let's see um git shale and initial commits okay there's no bug in this commit so i mark this commit as a good commit so git bisect good and the initial commit this is the initial commit uh did you see that we're not on the main branch anymore git has changed the head to a new commit in fact git bisect will assert its work after we specify a good commit and a bad commit so now we need to specify the current head is a good commit or not to do that we can check the main file so cat main text as you see the current head has the box so i have remarked this commit as a bad commit so git bisect bat okay now we're on a new commit let's check if it has the bug or not so cat main text okay there's no bug here so we mark this commit as a good one so git bisect good and that's it we found the bat commit and here it is showing us the bad commit information um we can't even see the bisect like so git bisect log see and to finish the bisect operation type git bisect reset okay that was it hope you enjoyed this tutorial please subscribe to my channel and comment if you have any questions [Music] you
Info
Channel: Absolute Code
Views: 34
Rating: undefined out of 5
Keywords: git, github, git bisect tutorial, what is git bisect, git bisect
Id: fUOTcqn8tp4
Channel Id: undefined
Length: 4min 15sec (255 seconds)
Published: Wed Sep 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.