🌳 Interactive local branch explorer with fuzzy search
Note
Currently only macOS (Apple Silicon) and Linux (x86_64) are supported.
curl -fsSL https://github.com/suvanl/mybranches-kt/releases/latest/download/mb-macos-arm64.tar.gz | tar xz
sudo mv mb /usr/local/bin/curl -fsSL https://github.com/suvanl/mybranches-kt/releases/latest/download/mb-linux-x64.tar.gz | tar xz
sudo mv mb /usr/local/bin/curl -fsSL https://github.com/suvanl/mybranches-kt/releases/download/v<VERSION>/mb-macos-arm64.tar.gz | tar xz
sudo mv mb /usr/local/bin/curl -fsSL https://github.com/suvanl/mybranches-kt/releases/download/v<VERSION>/mb-linux-x64.tar.gz | tar xz
sudo mv mb /usr/local/bin/Alternatively, download the binary from the Releases page.
After cloning the repo and cding into it, compile the program:
# macOS:
./gradlew linkReleaseExecutableMacosArm64
# or Linux:
./gradlew linkReleaseExecutableLinuxX64To be able to execute the program using mb:
- Rename the binary:
# macOS: cp build/bin/macosArm64/releaseExecutable/mb.kexe mb # or Linux: cp build/bin/linuxX64/releaseExecutable/mb.kexe mb
- Move the binary:
mv mb /usr/local/bin # or elsewhere on PATH
Follow the same steps as installing. mv will overwrite the existing binary in place.
mb lists local branches matching $USER/* (i.e. branches prefixed with your system username).
- Run
mbwithin a git repo - Select the desired branch (using ↑↓ or kj)
- Hit ⏎ Enter to switch to it
It's possible to fuzzy search the list, by pressing / and entering your search query. To lock the filter (e.g. to allow for navigation within the subset with k and j), hit ⏎ Enter. To exit search, hit Esc.
This is a Kotlin/Native project which compiles down to a platform-native binary. The currently supported targets are:
- linuxX64
- macosArm64
From the root project directory, build a debug executable for the desired compilation target using the
linkDebugExecutable<TargetName> command:
./gradlew linkDebugExecutableMacosArm64To build both debug and release executables, use the <targetName>Binaries lifecycle task:
./gradlew macosArm64BinariesNote
Release binaries are highly optimised. As a result, compilation of release binaries takes an order of magnitude more time than debug binaries.
Binary output lives under build/bin/<targetName>/debugExecutable/ and releaseExecutable/ when built.
To run the project, execute the build/bin/<targetName>/debugExecutable/mb.kexe command for the desired target, e.g.
build/bin/macosArm64/debugExecutable/mb.kexeRun <targetName>Test to run all tests in the project for the given target, e.g.
./gradlew macosArm64Test