A (probably overengineered) program that allows you to interactively switch to a local branch matching a certain pattern. By default, this pattern is your username.
While working on projects with multiple collaborators, I'd often find myself repeating these steps when trying to find one of my branches:
- have a number of local branches
- run
git mybranches(alias forgit branch --list "<username>*") - manually select + copy the name of the branch I'm looking for to the clipboard
- run
git switch <branchname>
This automates that process.
- Clone this repository
- Run
make -B - Create symlink to directory on
$PATH(useecho $PATHto check).- E.g., if /usr/local/bin is on your PATH:
ln -s ~/path/to/repo/bin/mybranches /usr/local/bin/mybranches
mybranches
Optional flags:
--pattern: Specify a custom pattern. This gets passed togit branch --list <pattern>*. Defaults to your system username.--cleanup: Run the cleanup program. This will delete all local branches gone from remote.
Important
The "copy to clipboard" feature is currently only supported on macOS and Windows.
