GitSwitchBranch is a CLI tool designed to simplify switching between Git branches interactively. It streamlines the process of managing long branch names by allowing users to either search for branches using partial names or select from a numbered list.
Key Features:
Interactive Selection: Displays a numbered list of branches, enabling quick selection by typing the corresponding number.
Direct Switching: Supports switching to a specific branch by providing its full name or a fragment of it on the command line.
Smart Search: Filters and displays matching branches when partial names are entered, reducing manual effort in finding the right branch.
Audience & Benefit:
Ideal for developers working with long or complex branch names, GitSwitchBranch helps reduce errors associated with typing or copying branch names. It is particularly useful for teams that utilize task IDs or descriptive branch naming conventions, offering a faster and more efficient way to manage branches across different environments.
Available for installation via winget, GitSwitchBranch works seamlessly on macOS, Linux, and Windows, providing a consistent experience across platforms.
README
git-switch-branch
A small CLI tool to quickly switch Git branches by typing a number or searching by name.
This tool helps when your team uses long branch names (for example including task IDs). Instead of copying/pasting long branch names, run the program and pick the branch to checkout. You can also provide a branch (or a fragment of it) on the command line to switch directly.
Features
Interactive selection: run without arguments to see numbered branch list, then type a number to switch.
Direct switch: pass a full branch name to switch immediately.
Smart search: pass part of a branch name to either:
Switch directly if there's exactly one match
Get a filtered list if multiple branches match
Works on macOS, Linux and Windows (native, prebuilt, self-contained binaries are available in Releases).
Quick examples
Interactive mode (shows numbered list):
git-switch-branch
Search by part of branch name:
git-switch-branch PROJECT-123
# If only one branch contains PROJECT-123: switches to it
# If multiple matches: shows numbered list of matching branches
GitSwitchBranch -r | --remote
# Include remote branches
Installation
Download the latest pre-built binary for your platform from the Releases page and place the executable in a folder on your PATH (for example /usr/local/bin on macOS/Linux or a user-local bin folder on Windows).
Building from source
Requires .NET 9.0 SDK:
# build and test
dotnet build && dotnet test