Chapter 8. Finding Commits
Part of a good version control system is the support it provides for âarchaeologyâ and investigating a repository. Git provides several mechanisms to help you locate commits that meet certain criteria within your repository.
In this chapter weâll teach you techniques you can use to find specific commits and their metadata. Weâll focus on three methods you can leverage to search through your repositoryâs commit history. The first method is very robust and is helpful in locating a single commit satisfying your search criteria. The second method provides information about commits that introduced changes to a file, and the third method uses a specific search variation with the regular git log
command.
Besides arming you with search skills in Git when working with commits, this chapter also provides a segue to Chapter 9, where weâll delve into the topic of altering the commits you found.
Using git bisect
The git bisect
command is a powerful tool for isolating a particular commit based on essentially arbitrary search criteria. It is well suited to those times when you discover that something âwrongâ or âbadâ is affecting your repository and you know the code had been fine. For example, letâs say you are working on the Linux kernel and a test boot fails, but youâre positive the boot worked sometime earlier, perhaps the previous week or at a previous release tag. In this case, your repository has transitioned from a known âgoodâ ...
Get Version Control with Git, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.