How to search branch names in git?

I’d like to find a specific branch, I know that it’s name would contain a specific substring (the id of the issue from our bug tracker) but I don’t know the whole name of the branch (this is what I want to find out).

How can I search for this branch?

  • Why my deployment check failing here
  • Merging a feature branch that is based off another feature branch
  • Android Compilation: No rule to make target
  • How to work around “multiple merge bases” error in EGit Eclipse plugin?
  • Can't install GitHub on Windows 7 (64 bit)
  • using git to scan source code to generate todo list etc
  • Interfacing Subversion with git
  • Git post-receive hook loop though all commits
  • Git: How to find whether origin/master is equivalent of (local) master?
  • Migrating existing Git repo to new Git LFS enabled repo
  • Gitlab post-receive/update hook to forward a commit to another git repo
  • Clean Git Repository using gitignore
  • 5 Solutions collect form web for “How to search branch names in git?”

    git branch --all | grep <id>
    
    git branch -a | grep selector
    

    Or

    git branch -r | grep selector
    

    -a shows all local and remote branches, while -r shows only remote branches.

    Building of the answers that others have given, I added this to my .gitconfig

    [alias]
      findb = "!f(){ git branch -ra | grep $1; }; f"
    

    So on the command line I can type git findb BUG-123

    assuming that you are using git hub there is a drop down list for your branches and tags in that drop down menu there is a search area. you can use that search area to search for your branch name

    Really late, but I found a better solution: git branc --list <pattern>, no need to go to grep.

    This works with wildcards (*) as well, so you can do use git branch --list *<id>* to find your branch.

    Git Baby is a git and github fan, let's start git clone.