Open In App

Git- Debugging

Like traditional word editors, we cannot undo changes simply. We have various git commands available to debug and undo changes. We will discuss such commands in this article.

git bisect: This command uses the binary search algorithm to find out the commit that introduced a bug. It is used by first telling it “bad” commit i.e. commit that is known to contain bug and “good” commit that is known to be before bug was introduced. Then git bisect picks a commit from “bad” commit and ask whether the selected commit is good or bad and runs until the “good” commit is reached.



How it works?

After the following set of commands, git selects the commit in the middle range, checks it and return output.



Note: In this image, we have not mentioned any version of git bisect bad and git bisect good, so when we don’t mention any version, the current version is taken by default.

git bisect options:

git clean: The git clean command is used to delete untracked files from git project. This command completely removes files from the working tree and cannot be recovered again. So this command should be carefully used.

git clean options:

Interactive Mode: It is the command loop which displays the available sub commands.

Article Tags :