When you start interacting with a new Git repository, you might want to understand its history. Git has a variety of commands that let you dig into these details. This chapter describes how to survey a repository’s history by using git log, git shortlog, and git name-rev. The chapter also focuses on commands that help you understand the files in the repository: git grep, git show, and git blame.
If you’re going to start work on an existing repository, especially one with lots of contributors or lots of history, you’ll want to perform a kind of archaeological survey of the code base. You’ll want to examine the code base at a high level and then narrow down to a particular set of files for a closer examination. These Git tools enable you to perform this survey of the code base. Let’s get digging!
git log is the command that displays your repository’s timeline history. You’ve been using this throughout the book already, but if you look at its documentation, you’ll see that it has a rich set of capabilities. You’ll check out some of that functionality here.