Chapter 7. Searching Git Repositories: Git a Grep

Image

The truth is, your project and its commit history are going to grow over time. Every so often, you will need to search your files for a particular piece of text. Or perhaps you’ll want to see who changed a file, when it was changed, and the commit that changed it. Git can help you with all of that.

And then there is your commit history. Each commit represents a change. Git allows you to search not only for every instance of a piece of text in your project, but also for when it was added (or removed). It can help you search your commit messages. To top it off, sometimes you want to find the commit that introduced a bug or a typo. Git offers a special facility that allows you to quickly zero in on that commit.

What are we waiting for? Let’s go search some Git repositories, shall we?

Taking things to the next level

Business is booming! Trinity’s event-planning business has really blossomed, thanks to repeat customers. Speaking of which, Gitanjali and Aref have hired Trinity again—this time to plan their wedding.

Image

Get Head First Git 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.