README
¶
git-better-branch
A better git branch viewer for repositories with long branch names, worktrees, and many remotes.
The problem
git branch -avv becomes unreadable when working with long branch names (e.g., ticket IDs), worktree paths, and hundreds of remote branches:
ahead b38bdb6 [origin/ahead: ahead 1] Empty commit
behind 0e3c069 [origin/behind: behind 1] Add GoReleaser relea
se workflow and Homebrew tap support
diverged 9893a15 [origin/diverged: ahead 1, behind 1] Empty com
mit
gone 4a820a9 [origin/gone: gone] Add version badge to READM
E
local 4a820a9 Add version badge to README
* main 4a820a9 [origin/main] Add version badge to README
upstream 4a820a9 [origin/main] Add version badge to README
+ worktree 4a820a9 (/Users/rich/Developer/git-better-branch/workt
ree) [origin/worktree] Add version badge to README
remotes/origin/HEAD -> origin/main
remotes/origin/ahead 4a820a9 Add version badge to README
remotes/origin/behind 4a820a9 Add version badge to README
remotes/origin/diverged 4a820a9 Add version badge to README
remotes/origin/main 4a820a9 Add version badge to README
remotes/origin/worktree 4a820a9 Add version badge to README
The solution
git better-branch gives you the same information in a compact, readable format:
* main origin 4a820a9 Add version badge to README
+ worktree origin 4a820a9 Add version badge to README [worktree]
ahead ↑1 origin b38bdb6 Empty commit
behind ↓1 origin 0e3c069 Add GoReleaser release workflow and Hom…
diverged ↑1↓1 origin 9893a15 Empty commit
gone gone origin 4a820a9 Add version badge to README
local local 4a820a9 Add version badge to README
upstream origin/main 4a820a9 Add version badge to README
ahead origin 4a820a9 Add version badge to README
behind origin 4a820a9 Add version badge to README
diverged origin 4a820a9 Add version badge to README
main origin 4a820a9 Add version badge to README
worktree origin 4a820a9 Add version badge to README




| Normal mode | Interactive mode |
|---|---|
Features:
- Smart truncation of branch names and commit messages to fit your terminal
- Compact tracking status:
↑3(ahead),↓2(behind),↑3↓2(diverged),gone,local - Tracking remote shown in its own column; full upstream ref shown only when it differs from the local branch name
- Worktree indicator:
+prefix with[worktree-name]tag instead of full absolute paths - Remote branches listed with
-a, colored red to distinguish from local branches - Color-coded output, automatically disabled when piped
- Terminal-width aware column layout
- Auto-pager when output exceeds terminal height
- Interactive mode (
-i): TUI branch picker with fuzzy search and checkout
Installation
Homebrew (macOS and Linux)
brew install redodson01/tap/git-better-branch
From source
Requires Go 1.26+.
git clone https://github.com/redodson01/git-better-branch.git
cd git-better-branch
make install # installs to ~/.local/bin by default
Or specify a different prefix:
make install PREFIX=/usr/local
Ensure the install directory is in your PATH.
Usage
git better-branch # local branches
git better-branch -a # include remote branches
git better-branch -i # interactive branch picker
git better-branch -i -a # interactive with remote branches
git better-branch --no-color
git better-branch --version
Passthrough
Flags and arguments not recognized by git better-branch are passed through to git branch:
git better-branch -m old-name new-name # rename a branch
git better-branch -d feature # delete a branch
git better-branch -v # verbose git branch output
git better-branch --sort=-committerdate # sort by recent commit
Interactive mode
Use the -i flag to launch a TUI branch picker:
/to fuzzy search (matches branch names and remote names)j/kor↑/↓to navigateg/GorHome/Endto jump to top/bottomPgUp/PgDnto scroll by pageEnterto checkout the selected branchdto delete a branch (git branch -d);Dto force-delete (git branch -D) or delete a remote branchEsc/qto quit
Aliases
# git bb
git config --global alias.bb better-branch
# gbb (shell alias — add to your .bashrc/.zshrc)
alias gbb='git better-branch'
License
Documentation
¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.