A Git utility that shows recently checked-out branches in chronological order and lets you quickly switch between them.
Project description
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-coloror off with--no-color - lbranch respects the
NO_COLORandFORCE_COLORenvironment 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 tap dcchuck/lbranch
brew install lbranch
License
Distributed under the MIT License. See LICENSE
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lbranch-0.1.4.tar.gz.
File metadata
- Download URL: lbranch-0.1.4.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14b1617d14768e6f1bc710c20a2b014710b67623b313788ec92d886ff5b44671
|
|
| MD5 |
985adf9c6839a1d0904d2e16eeeac84a
|
|
| BLAKE2b-256 |
0e82b731933c4557e7779ac8cf7695f3c6ae5a710a113b42c1baf46c649bf449
|
File details
Details for the file lbranch-0.1.4-py3-none-any.whl.
File metadata
- Download URL: lbranch-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e70044513610d54ef3e556b2e41f64952ac65f4b08f6bf2014c82720840bf72
|
|
| MD5 |
2ccaf18aff8d28704e8f8199e373fd7d
|
|
| BLAKE2b-256 |
aea2d80153c1ccadc3ee536dd675b498523ca26cafae65f5424e8d9d50077225
|