Git
Chapters ▾ 2nd Edition

A3.7 Git Commands - Debugging

Debugging

Git has a couple of commands that are used to help debug an issue in your code. This ranges from figuring out where something was introduced to figuring out who introduced it.

git bisect

The git bisect tool is an incredibly helpful debugging tool used to find which specific commit was the first one to introduce a bug or problem by doing an automatic binary search.

It is fully covered in “Binary Search” and is only mentioned in that section.

git blame

The git blame command annotates the lines of any file with which commit was the last one to introduce a change to each line of the file and what person authored that commit. This is helpful in order to find the person to ask for more information about a specific section of your code.

It is covered in “File Annotation” and is only mentioned in that section.

git grep

The git grep command can help you find any string or regular expression in any of the files in your source code, even older versions of your project.

It is covered in “Git Grep” and is only mentioned in that section.