Read more

Git: Search for text in all branches

Henning Koch
September 17, 2020Software engineer at makandra GmbH

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

git grep foo $(git rev-list --all)
Illustration online protection

Rails professionals since 2007

Our laser focus on a single technology has made us a leader in this space. Need help?

  • We build a solid first version of your product
  • We train your development team
  • We rescue your project in trouble
Read more Show archive.org snapshot

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
Posted by Henning Koch to makandra dev (2020-09-17 09:14)