Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Git: List branches that contain a word.

Tags: git, branch, search, grep

List branches that contain a word.

\> git branch --list *some-word*
my-branch-some-word-goes-here
another-branch-some-word-9879
your-branch-some-word-rebased

 

List branches that contain one or more words.

git branch --list *pattern* *pattern*

 

See https://git-scm.com/docs/git-branch

If a <pattern> is given, it is used as a shell wildcard to restrict the output to matching branches. If multiple patterns are given, a branch is shown if it matches any of the patterns. Note that when providing a <pattern>, you must use --list; otherwise the command is interpreted as branch creation.