I made some changes in a git
branch of a very busy repository.
Got distracted with other features and bug fixes, switched branches a few dozen times, and never pushed that change to the master.
And now I am trying to identify one of literally hundreds of branches where I made the change. The change didn't produce any new files and the only way to find it (apart from improving my memory) is to search for certain words in the source files.
Is it possible to grep for a keyword in source files across multiple git
branches?
git grep is the tool for that.
You can search in specific branches or revisions:
git grep '<search term>' branch1 branch2 branch3
or search through all revisions:
git grep '<search term>' $(git rev-list --all)