by Ryan Irelan
A log of commits in Git (retrieved using git-log) can be filtered and changed to output only the commits (or types of commits) that we want to see.
Typically, you review the repository history using git-log by running:
The default log is great for grabbing a quick look at what just happened in the repository. But it takes up a lot space and you can only see a handful of commits at once, unless you have a display the size of a building.
Sometimes, however, we want to only find changes that included certain keywords in the commit message. To do this we use the
--grep option and pass in a term or regular expression.
git log --grep="homepage"
This will return a log with commits that only reference the word “homepage” in the commit message.
Used in conjunction with other
git-log options (like
--since), you can very quickly narrow down the commits to exactly what you’re looking for.
Invest a small amount of time to improve how you use Git with our practical tutorial.