Difficulty: Beginner
Estimated Time: 10 minutes

Software bugs have been an problem for as long as software has existed. As Git records all the commits to the repository then it becomes a great source of information and diagnostic tool when identifying how issues were introduced.

In this scenario we'll explore the different ways you can find which commit introduced the problem. The environment has been initialised with a Git repository containing a single HTML file which renders a list of items.

With the comprehensive history of your source code within the Git repository allows you to go back in time and identify when issues occurred, such as bugs or performance issues. Commands like git diff allow you to quickly compare changes, while git bisect helps you search to identify the cause.

This scenario has been added to your scrapbook where you can review the examples and commands you executed.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Scenario 7 - Finding Bugs

Step 1 of 4

Git Diff Two Commits

The git diff command is the simplest to compare what's changed between commits. It will output the differences between the two commits.

Example

You can visually any two commits by providing the two commits hash-ids or pointers (blobs)

git diff HEAD~2 HEAD