From the course: Complete Guide to Git

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Compare commits

Compare commits

- [Instructor] In this movie, we'll learn how to compare commits to review all of the changes that took place between them. This illustration represents each commit on the main branch as a box with an abbreviated version of the SHA inside. The older commits are to the left, and the newer commits are to the right. We already know that we can use "git show" to view a particular commit. When we do, git tells us the changes that were in that commit. In other words, it shows us what changed from the previous commit. In this example, it would show us what changed from after 534de was committed, until after 7a32e was committed. We can also use the "diff" command to get similar output by providing these two SHA's as arguments. The older commit is listed first, and the newer one is listed second, or there's a format that will allow you to use two or three periods between the SHA's, if you prefer that. These will all show what changed between those two commits. The diff command may be longer to…

Contents