Skip to main content

lbranch

lbranch ("last branch") is a git utility that shows your recently checked out branches in chronological order, with an optional interactive checkout.

Usage

# Show last 5 branches (default)
lbranch
# Show last N branches
lbranch -n 3
lbranch --number 3
# Show branches and select one to checkout
lbranch -s
lbranch --select
# Show last N branches and select one
lbranch -n 3 -s
# Color control
lbranch --no-color     # Disable colored output
lbranch --force-color  # Force colored output even in non-TTY environments

Example Output

Last 5 branches:
1) feature/new-ui
2) main
3) bugfix/login
4) feature/api
5) develop

Color Support

lbranch automatically detects if your terminal supports colors:

  • Colors are disabled when output is not to a terminal (when piped to a file or another command)
  • Colors are disabled on Windows unless running in a modern terminal (Windows Terminal, VS Code, etc.)
  • You can force colors on with --force-color or off with --no-color
  • lbranch respects the NO_COLOR and FORCE_COLOR environment variables

Exit Codes

lbranch follows the standard exit codes from sysexits.h for better integration with scripts and other tools:

  • 0: Success
  • 64: Command line usage error (not in a git repository, invalid selection)
  • 66: Cannot open input (no branch history/no commits)
  • 69: Service unavailable (git command not found)
  • 75: Temporary failure (branch checkout failed, retry possible)
  • 130: Operation interrupted (Ctrl+C)

These follow Unix conventions where exit codes 64-78 are standardized error codes, and 128+N indicates termination by signal N.

Requirements

  • Python 3.7+
  • Git

Installation

Using pip

You can install lbranch directly from PyPI:

pip install lbranch

Using Homebrew

You can install lbranch using Homebrew:

brew install dcchuck/tap/lbranch

License

Distributed under the MIT License. See LICENSE

Metadata

Release files for lbranch 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lbranch 0.1.5
File Size Uploaded
lbranch-0.1.5.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lbranch 0.1.5
File Interpreter ABI Platform
lbranch-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / lbranch-0.1.5.tar.gz

Download URL lbranch-0.1.5.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
14422082a9b94d04f05433b1935a2fd16098dd46a3e395ad87d508d9caedd372
BLAKE2b-256 checksum
How to use checksums
6b1e10996b4a5cf89cf38fc9a977f5b6c7f76cff5b42ffd9dabea7c51db1f8b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / lbranch-0.1.5-py3-none-any.whl

Download URL lbranch-0.1.5-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21c3ccc168a2fe1eab8375287a8913045405855c024507da43b2213bdae3eab8
BLAKE2b-256 checksum
How to use checksums
960df6f6e2b6418fef2b859d19dfe0cb06b1034aa3c7b8a54c0a62fa6e9e6e1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page