This happens to me more often than I think I would like to admit. With the following two git tricks, you can always figure out exactly where the change is your are looking for.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep across all commits | |
git grep <pattern> $(git rev-list --all) | |
# find out which branch(es) contains said commit | |
git branch -r --contains <sha1> |
The first command does two things.
- expands a listing of all the commits using `git rev-list --all`
- greps across those commits for the pattern.
The second command identifies which branch(es) the commit resides in.
It's these simple things that make me really love git.