last-branches-cli
v0.1.2
Published
Interactive CLI to list recent git branches and checkout selected one
Downloads
8
Maintainers
Readme
last-branches

Super simple interactive CLI to list your most recent local git branches and checkout the one you pick.
Install
Global install (recommended):
npm install -g last-branches-cli
# or
pnpm add -g last-branches-cli
# or (Yarn classic)
yarn global add last-branches-cliThen run:
last-branchesZero‑install (runs without a global install):
npx last-branches
# or
pnpm dlx last-branches
# or
bunx last-branchesUsage
last-branches [-C <dir>] [-n <limit>] [-h|--help]-C <dir>: Run as if git was started in<dir>-n <limit>: Max branches to show (default 30)-h, --help: Show help
Examples:
# In a git repo
last-branches
# From anywhere, target a repo
last-branches -C ~/code/my-repo
# Show more branches
last-branches -n 100Requirements
- Node.js >= 16
- A git repository (local branches are listed)
Troubleshooting: command not found
Most Node installs expose the global bin directory on your PATH. If last-branches is not found after a global install:
- Find the global bin directory:
npm bin -g- Add it to your shell profile:
- zsh (
~/.zshrc):
echo 'export PATH="$PATH:$(npm bin -g)"' >> ~/.zshrc && exec zsh- bash (
~/.bash_profileor~/.bashrc):
echo 'export PATH="$PATH:$(npm bin -g)"' >> ~/.bash_profile && source ~/.bash_profileIf you use nvm, ensure its initialization snippet is present in your shell profile so the correct Node version's global bin is on PATH.
Maintainers
Ensure the entry file is executable before publishing:
chmod +x bin/last-branches.jsLicense
MIT
