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?

  • Gitolite Eclipse 'Auth fail'
  • How to detect if a git clone failed in a bash script
  • Remotely Track the Current Branch in Git
  • Git find all binary files in history
  • Ignoring Hidden Files git
  • How can I see all the files that were modified/added/removed in the last push received?
  • AWS CodeCommit HTTPS access without setting up credential helper
  • git-blame for pull requests
  • pushing to elastic beanstalk removes files created on servers
  • Git slow sometimes
  • How to download google source code for android
  • unable to update submodule
  • 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.