gitrat 0.2.0

A Ratatui-powered CLI for interactively staging, diffing, and committing git changes
gitrat-0.2.0 is not a library.
Visit the last successful build: gitrat-0.3.0

gitrat

CLI project to see git changes and commit. I created this project to personal use, feel free to contribute.

gitrat running in the terminal

Installing

Cargo 🦀

Installing from crates.io (requires Rust/Cargo):

cargo install gitrat

Homebrew 🍻

You can install with Homebrew:

brew tap heroesofcode/taps
brew install heroesofcode/taps/gitrat

Usage

gitrat            # open the repository containing the current directory
gitrat path/to/repo
gitrat --no-mouse # keep the terminal's native text selection
gitrat --theme light   # force light/dark colours (default: auto)

The diff view shows old/new line numbers, syntax highlighting (bat's language set, including Rust, Swift, Kotlin, TypeScript, TOML…), tinted added/removed lines and word-level highlighting of exactly what changed inside a line.

gitrat works from any subdirectory of a repository, refreshes automatically when files change, and runs git push in the background so the UI never freezes.

Keys

Key Action
j/k, ↑/↓, Tab next / previous file (mouse click also selects)
Space / Enter stage or unstage the selected file
a / A stage all / unstage all
r revert the selected file (asks for confirmation)
x remove the selected file (asks for confirmation)
c write a commit message (Enter commits, Esc cancels)
p push (sets the upstream automatically)
Ctrl-D / Ctrl-U scroll diff half a page
Ctrl-F / Ctrl-B scroll diff a full page
J / K, Shift-↓ / Shift-↑ scroll diff one line
g / G top / bottom of the diff
h / l, ← / → scroll diff horizontally
R, F5, Ctrl-L refresh
? help
q, Ctrl-C quit

In the commit bar: Ctrl-W (or Option-Delete with "Use Option as Meta key") deletes a word, Ctrl-U clears, and pasting multi-line text is safe (newlines become spaces).

Platforms

gitrat runs on macOS, Linux and Windows; it only needs git on the PATH.

Light or dark colours are picked from COLORFGBG or, failing that, the system appearance: macOS dark mode, the GNOME/GTK color-scheme setting on Linux, or the Windows app theme. Override with --theme light|dark. 24-bit colour is used when the terminal advertises it (COLORTERM=truecolor, Windows Terminal, iTerm2, Ghostty, WezTerm…), otherwise a 256-colour palette.

git push never prompts inside the TUI: use a credential helper (macOS keychain, Git Credential Manager, libsecret…) or an SSH agent.

To select text with the mouse while gitrat is running, hold Fn on macOS or Shift in most Linux and Windows terminals (or start with --no-mouse).

Terminal.app keeps PageUp, PageDown, Home and End for its own scrollback, so every diff action also has a letter binding.