Grep Git Branch Names, Return Only Branches Whose Name Contain “Theme”

If I have a list of 48 remote branches for a repo, I can do

git branch -a

To list all of them, how do I grep through those to only return the ones whose name contains Theme?

  • Git: Diff does not handles character encoding other than UTF-8?
  • Gulp - Get return value of one task from another
  • To get Git-prompt work in Zsh without a bug in a function
  • Longer Filenames with git merge
  • GIT how can I repair the history of a moved file (specifically for blame, etc)
  • Github: routing different project messages to different emails on my account
  • How to link already existing TFS-git commit to TFS work item?
  • How to create reflogs information in an existing bare repository
  • git push fails unless I do a gc on the remote repo first
  • “git push” and “git push --tags” in the same command?
  • Best way to handle offline and online development with Git
  • configuring existing git repo for sparse checkout
  • 3 Solutions collect form web for “Grep Git Branch Names, Return Only Branches Whose Name Contain “Theme””

    No need to use grep. You can just use git branch --list <pattern> where <pattern> can contain wildcards:

    git branch --all --list *Theme*
    

    The --all option will include remote branches in the search.

    Just use the pipe operator (|):

    git branch -a | grep Theme
    

    You could pipe the output to grep.

    git branch -a | grep Theme
    
    Git Baby is a git and github fan, let's start git clone.