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?
a,b, andcand the searching through all reachable commits (all commits on all branches).feature/withgit grep <search> $(git for-each-ref --format='%(refname:short)' 'refs/heads/feature/**'). That’s a glob (not a regex) but it’s powerful enough for patterns like that.