Skip to content

Repository files navigation

mybranches-kt

🌳 Interactive local branch explorer with fuzzy search

demo

Installation

Note

Currently only macOS (Apple Silicon) and Linux (x86_64) are supported.

Download the latest release

macOS

curl -fsSL https://github.com/suvanl/mybranches-kt/releases/latest/download/mb-macos-arm64.tar.gz | tar xz
sudo mv mb /usr/local/bin/

Linux

curl -fsSL https://github.com/suvanl/mybranches-kt/releases/latest/download/mb-linux-x64.tar.gz | tar xz
sudo mv mb /usr/local/bin/

Download a specific release

macOS

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/

Linux

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.

Build from source

After cloning the repo and cding into it, compile the program:

# macOS:
./gradlew linkReleaseExecutableMacosArm64

# or Linux:
./gradlew linkReleaseExecutableLinuxX64

Optional: rename binary and add to PATH

To be able to execute the program using mb:

  1. Rename the binary:
    # macOS:
    cp build/bin/macosArm64/releaseExecutable/mb.kexe mb
    
    # or Linux:
    cp build/bin/linuxX64/releaseExecutable/mb.kexe mb
  2. Move the binary:
    mv mb /usr/local/bin  # or elsewhere on PATH

Updating

Follow the same steps as installing. mv will overwrite the existing binary in place.

Usage

mb lists local branches matching $USER/* (i.e. branches prefixed with your system username).

Basic operation

  1. Run mb within a git repo
  2. Select the desired branch (using or kj)
  3. Hit ⏎ Enter to switch to it

Searching

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.

Development

This is a Kotlin/Native project which compiles down to a platform-native binary. The currently supported targets are:

  • linuxX64
  • macosArm64

Build and run the project

From the root project directory, build a debug executable for the desired compilation target using the linkDebugExecutable<TargetName> command:

./gradlew linkDebugExecutableMacosArm64

To build both debug and release executables, use the <targetName>Binaries lifecycle task:

./gradlew macosArm64Binaries

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.kexe

Run the tests

Run <targetName>Test to run all tests in the project for the given target, e.g.

./gradlew macosArm64Test

About

🌳 Interactive local branch explorer

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages