1

In github, my account can access multiple related repositories. A user story can be implemented as same-name branches in multiple repositories.

  • Given a branch's name, can I find out which repositories contain a branch with the given name?

  • Can I further jump to such a branch in a given repository?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Tim
  • 1
  • 141
  • 372
  • 590

1 Answers1

2

Probably the simplest way of searching repositories for branch names is to use the command git branch within each repo. You can specify git branch -a for local and remote branches, or git branch -r for just remote.

This isn't ideal for a number of reasons, one being that you'd need to have command-line access to all the repositories you want to search (such as all the repos being cloned locally), another being that you'll have to manually scan through the branch list that git branch outputs.

One possible solution to this is to use the GitHub API to list all repos and / or all branches. The answer here gives a decent example in Python of how to authenticate (to allow access to private repos), which you would need to follow with the API's GET request:

GET /repos/:owner/:repo/branches
Community
  • 1
  • 1
codemacabre
  • 1,112
  • 12
  • 20