Git

How to do Git Bug Analysis?

0
(0)

Suppose we found any broken code on our branch, then to debug and found the exact issue becomes a tedious task. So, to avoid such scenarios, we can use the git bisect command to find the bad project revision and can fix it with the git revert command.

How does git bisect work?
This command divides or bisects the history between good and bad commit range. It points the current project state as mid-range commit. the bisect command will move through every commit between this range while pausing at each commit to allow you to test the code and mark bad or good based on bug existence.

syntax:

Start the bisect command:

git bisect start

mention the bad commit id:

git bisect bad c4331

or

git bisect bad HEAD

mention the good commit id:

git bisect good 97292321

To reset bisect you can use:

git bisect reset

How to fix the code?
You can do this by using couple of workarounds. However, you can revert the changes done by bad commit by using below command:

git revert <comit id>

How useful was this post?

Click on a star to rate it!

Leave a Reply

Your email address will not be published. Required fields are marked *