⠀⠀⠀⣴⣀⣤⣦⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢠⣴⠿⠛⣿⣿⠋⠻⣿⣟⠻⠿⠿⢿⣿⣿⣶⣶⡦⣤⣀⡀⠀
⢰⣿⣧⣴⣦⢿⣿⣷⡦⠘⣿⠀⠀⠀⠀⣹⠉⣿⣿⣿⣶⣬⣷⠀
⠘⠟⢻⣿⠋⠀⢿⣿⣷⣼⣿⣷⣤⣤⣴⣿⣿⣿⣿⣿⣿⣿⢿⠃
⠀⠀⢠⣿⣶⣶⣿⣿⣿⣿⠟⠉⠉⠙⠻⠟⡿⢻⢿⢻⡏⠏⠀⠀
⠀⣾⣿⣿⣿⣿⣿⣿⣿⣧⣤⣀⡀⠀⠀⠀⠁⠈⠘⠈⠀⠀⠀⠀
⠀⠈⠉⠳⣾⣿⣿⣿⣿⣿⣿⣿⣿⣦⣶⣄⢠⢰⣴⢠⠀⣄⠀⠀
⠀⠀⠀⠀⠈⠙⠿⣿⣝⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣷⡟⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠙⠛⠛⠛⠛⠛⠛⠛⠛⠻⠿⠟⠋⠀⠀⠀
A terminal-first git manager written in Rust.
Interactive terminals open the TUI by default. Non-interactive runs stay on the CLI path.
Overview · Architecture · TUI · Commands · Development
gitrex packages the common git workflows into one terminal tool:
- Defaults to the TUI when both
stdinandstdoutare terminals - Falls back to CLI output for scripts, pipes, and automation
- Uses an embedded libgit2 backend, so it does not depend on the
gitbinary - Covers status, branch inspection, recent commit review, checkout, switch, branch creation, clone, pull, and push
- Includes a branch-focused TUI with local/remote panels, branch search, branch deletion confirmation, branch-specific graph navigation, and commit actions
- Shows a loading splash while the repository snapshot is being synchronized
flowchart TD
A[User starts gitrex] --> B{Interactive terminal?}
B -- yes --> C[TUI router]
B -- no --> D[CLI commands]
C --> E[App state + controller]
D --> F[Command output]
E --> G[libgit2 backend]
F --> G
G --> H[Repository]
sequenceDiagram
participant U as User
participant R as Router
participant T as TUI
participant C as CLI
participant G as GitClient
U->>R: run gitrex
R->>R: detect interactive terminal
alt interactive without subcommand
R->>T: open TUI
T->>G: refresh / branch / log operations
else subcommand given
R->>C: execute command
C->>G: read or mutate repository
end
The TUI is built around three top-level views:
StatusBranchesGraph
flowchart LR
H[Header] --> S[Status]
H --> B[Branches]
H --> G[Graph]
B --> L[Local branches]
B --> R[Remote branches]
G --> C[Commit actions]
B --> X[Delete confirmation]
H -. help (h) .-> O[Help overlay]
O --> M[Message]
1/2/3switch between status, branches, and graphj/kor arrow keys move within the active panelhopens the help screenEscorhcloses the help screenrrefreshes the repository state
TabandShift+Tabswitch between local and remote branch panels/opens branch search and filters both local and remote refsEnteropens the branch action picker for the active panel- In the local branch panel, branch actions include checkout, switch, pull, push, and creating a branch from the selected source
- In the local branch panel, branch actions also include deleting the selected local branch after confirmation
- In the remote branch panel, branch actions include creating a local branch, checking out detached HEAD, or deleting the selected remote branch after confirmation
j/kor arrow keys move between commitsEnteropens commit actions for the selected commit- The graph follows the selected branch in the Branches view
- The selected commit subject scrolls when it does not fit
The help screen is scrollable:
j/kor↑/↓scroll the shortcuts panel- A scrollbar shows position and range
- The bottom
Messagepanel stays fixed and shows the close hint
| Command | Description |
|---|---|
gitrex |
Opens the TUI in interactive terminals |
gitrex status |
Prints the current branch, upstream, divergence, and working tree state |
gitrex branch |
Lists remote branches grouped by remote and local branches with sync status |
gitrex log --limit <n> |
Shows recent commits from the current branch history, defaulting to 20 |
gitrex checkout <target> |
Checks out an existing branch or ref |
gitrex switch <target> |
Switches to a branch |
gitrex create-branch <name> --from <target> |
Creates a new branch, optionally from another ref |
gitrex clone <repository> [directory] |
Clones a repository to an optional destination |
gitrex pull [remote] [branch] |
Pulls updates from a remote and branch |
gitrex push [remote] [branch] |
Pushes commits to a remote and branch |
gitrex tui |
Forces the TUI explicitly |
branch: main
upstream: origin/main
working tree: clean
remote branches:
origin
main
feature/login
upstream
main
local branches:
* main [synced: origin/main, upstream/main]
feature/login [local-only]
release [local-only]
cargo build --releasecargo runTo force the TUI explicitly:
cargo run -- tuicargo run -- status
cargo run -- branch
cargo run -- log --limit 20cargo buildcargo test- Repository rules live in CONTEXT.md
- Format guidance lives in CONTEXT-FORMAT.md
- Rust 2021
clapfor CLI parsingcrosstermfor terminal controlgit2with vendored libgit2 for repository accesschronofor date formattingratatuifor the TUIanyhowandthiserrorfor error handling
- The CLI path prints a help hint when no subcommand is provided outside an interactive terminal.
- The TUI is the primary interactive experience.
- The TUI refreshes remote refs before reading status, branches, and history so the snapshot stays consistent.