Git: Search for text in all branches

Posted . Visible to the public.

To find a version containing the regular expression foo in the history of any branch:

git grep foo $(git rev-list --all)

You may also limit the search to a file extension, e.g. Ruby files (.rb) like this:

git grep foo $(git rev-list --all) -- *.rb
Henning Koch
Keywords
string, diff, commit, old
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2020-09-17 07:14)