Skip to content

Search All Git Branches for Specific Text/Regex


git branch -a | tr -d \* | sed '/->/d' | xargs git grep [string or regex]

This can be slow, though, and git log may be more effective.


git log -p --all -S 'search string'
git log -p --all -G 'match regular expression'

This produces list of commits, so we need to find branches containing this specific commit:


git branch -a --contains [commit string]