A terminal user interface (TUI) for viewing and switching git branches, built with Python and Textual.
I built this because I wanted a quick way to view git branches and switch between them. Built with Claude Code.
This provides a fast, easy way to browse branches, see the commit history for a given branch, identify files changed in a branch, and view file diffs with syntax highlighting. As an open source developer who works with many branches across multiple projects, this is very helpful for figuring out where I left off and juggling multiple branches.
- Browse local and remote branches in a navigable list
- View changed files compared to your default branch
- View commit history unique to each branch
- Syntax-highlighted diff viewer
- Checkout branches with Enter
- Create and delete branches
- Fetch, push, and pull operations
- Filter branches with
/search - Vim-style keyboard navigation
Requires Python 3.12 or later.
Install uv and run:
uv tool install gittwigTo run with uv without installing:
uv tool run --from gittwig twigRun twig in any git repository:
twigOr specify a repository path:
twig /path/to/repo| Key | Action |
|---|---|
j / k |
Move cursor down / up |
h / l |
Focus left / right pane |
g g |
Go to top of list |
G |
Go to bottom of list |
Ctrl+d / Ctrl+u |
Page down / up |
Enter |
Select item / checkout branch |
| Key | Action |
|---|---|
n |
Create new branch and switch to it |
d |
Delete branch (with confirmation) |
r |
Refresh data |
f |
Fetch from remotes |
p |
Push current branch |
P |
Pull current branch |
| Key | Action |
|---|---|
/ |
Search/filter branches |
? |
Show help |
q |
Quit |
Escape |
Close modal / cancel |
# Install development dependencies
uv sync --group dev
# Run tests
pytest
# Run linter
ruff check .
# Run type checker
mypy srcMIT License - see LICENSE for details.
0 comments
log in to comment.