Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitwatch

gitwatch is a small, minimalist terminal UI for keeping an eye on a Git working tree. It shows each changed path once, refreshes automatically, opens unified diffs, stages and unstages changes, and commits without leaving the terminal UI.

Install

Gitwatch requires a recent Rust toolchain and Git.

make setup
make install

For development, make run builds and launches an optimized binary. Run make help to see all available commands.

Usage

Start Gitwatch from anywhere inside the repository to watch:

gitwatch

The list combines index and worktree state into one row per path. A path with both staged and unstaged edits is labeled staged + modified; opening it shows the two patches in separate labeled sections. Untracked files are diffed against /dev/null.

File list

Key Action
/ , j / k Move the selection
Enter Open the selected file's unified diff
s Stage the selected path
u Unstage the selected path without discarding edits
S Stage all changes
U Unstage all changes without discarding edits
d Discard the selected path's unstaged changes after confirmation
c Commit staged changes with an inline message
a Toggle between the working tree and all changes on the branch
r Refresh immediately
? Show help
q Quit

All changes

Press a to switch from the working tree to everything this branch has accumulated since it forked: its own commits, plus staged edits, unstaged edits, and untracked files. This is what a pull request from the branch would contain right now. The header names the base and the fork-point commit, for example All changes 7 · vs origin/main (a1b2c3d), and each row is labeled added, modified, deleted, renamed, copied, type changed, or untracked.

Staging, unstaging, discarding, and committing are unavailable in this view — they act on the index, which a committed range does not describe. Press a again to go back.

The base is detected from origin/HEAD, then the first of origin/main, origin/master, upstream/main, upstream/master, main, master, and develop that exists. When you are already on the base branch, its upstream is used instead, so you see your unpushed commits. Pass --base <ref> to override the detection entirely. Diffs run against git merge-base <base> HEAD, so commits landing on the base branch after you forked are not counted as yours.

Diff view

Use j/k or the arrow keys to scroll, PgUp/PgDn to move by a page, g/G to jump to the beginning or end, and n/p to open the next or previous changed file. The fixed gutter shows old and new source line numbers. Press :, enter a 1-based source line number, and press Enter to jump directly to it; new-file lines are preferred and deleted old-file lines are used as a fallback. Esc returns to the list or cancels an active prompt. Press /, enter a case-sensitive search term, and press Enter to jump to the next matching diff line; matches remain highlighted.

Long diff lines wrap to the live visible pane width by default, with continuation rows aligned to the line-number gutter. Wrapping recalculates when the terminal is resized. Press w to toggle it; when wrapping is off, use h/l or the left/right arrow keys to scroll horizontally.

Gitwatch refreshes every second and preserves the selected path when possible. It delegates repository operations to the installed git executable, so ignore rules, hooks, submodules, and local Git configuration continue to work normally. Commit-hook and Git errors are shown in the interface.

Discarding a tracked path restores its worktree content from the index and therefore preserves staged changes. Discarding an untracked path permanently deletes that file; both operations require confirmation.

Command-line options

gitwatch --help
gitwatch --version
gitwatch --all                  # start in the all-changes view
gitwatch --base origin/develop  # compare against a specific ref; implies --all

Gitwatch intentionally operates on the current repository and does not accept a repository path argument.

About

git diffs

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages