# Branch Globs

> Goal: allow users to specify a glob pattern (like `deploy/**`) instead of spelling out every branch name that will be included in their repository.

Git branch: `branch-globs`

- Where are branches currently pulled?
  - There is `getBranchNames` in `src/repos.ts`.
  - If the branch is an object, like `{ glob: string, max: number}`, then
    we should query for get all branches from the main repository and see
    if any match.
  - There could be a branch that matches multiple globs
  - Put branches in a hash, with keys being the glob that matched them.
  - Remove the oldest branches (by last commit?) to limit to the `max` number
  - Then merge the branches into a set so there are no duplicates -- we don't
    actually care which glob matched the branch, we just want to be able to
    enforce the `max` value for a glob.

Use node's `path.matchesGlob()` method: https://nodejs.org/docs/latest/api/path.html#pathmatchesglobpath-pattern.

```js
path.matchesGlob('/foo/bar', '/foo/*'); // true
```
