Skip to content
ChowChowSonicPublic

About

A high-performance, Terminal-based directory comparison tool built with Rust & Ratatui

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

31 Commits

Folders and files

Repository files navigation

ripdiff

A terminal-based directory and git comparison tool built with Rust and Ratatui.

Description

ripdiff is a fast, parallel file tree and git diffing tool that displays differences in an interactive terminal UI. It compares directories or git revisions side-by-side, allowing you to navigate file trees and view file contents directly in your terminal.

Features

  • Git repository diffing - Diff between commits, remote branches, ranges (HEAD~3..HEAD), staged changes, or working tree edits
  • File or directory input - Accepts both files and directories as arguments
  • Parallel file discovery - Uses rayon and ignore for fast directory traversal
  • Side-by-side comparison - View file contents from both sides simultaneously
  • Interactive TUI - Navigate file trees with keyboard controls
  • Hunk navigation - Quickly jump across changes with /
  • Real-time file viewing - Open and scroll through file contents
  • Expandable directory tree - Navigate nested folder structures on-the-fly
  • Recursive folder change highlighting - Ancestor folders are highlighted yellow if any file within them is modified, added, or removed
  • Strict O(1) memory comparison - Progressive multi-tier metadata filtering and streaming 8 KB buffers ensure instant TUI startup and negligible memory footprint

Installation

cargo build --release

Usage

Filesystem Mode

Compare two directories or files on disk:

ripdiff <old_directory|old_file> <new_directory|new_file>

Git Mode

Run within any Git repository:

# Compare HEAD against local working tree changes (including untracked files)
ripdiff

# Compare a remote branch / commit against local working tree changes
ripdiff origin/HEAD
ripdiff main

# Compare two branches or commits
ripdiff main feature-branch
ripdiff v1.0.0 v2.0.0

# Compare a commit revision range
ripdiff HEAD~3..HEAD

# Compare staged changes against HEAD
ripdiff --staged

# Explicit git mode flag (optional when refs are detected)
ripdiff --git origin/HEAD
ripdiff -g main feature

Keybindings

Key Action
↑/↓ Navigate file list
Enter Open selected file/directory
←/→ Adjust filename display offset
PageUp/PageDown Scroll file contents
k/j Scroll file diff content
/ Jump to next diff change / hunk
Tab Toggle file sidebar
Esc Exit

Architecture

src/
├── main.rs      # Entry point: parses args and runs the app
├── lib.rs       # Module declarations
├── app.rs       # CLI argument parsing (clap) and app orchestration
├── git.rs       # Git repository inspection, revision resolving, and diff extraction
├── state.rs     # TuiState struct, file/navigation logic, unit tests
├── ui.rs        # Event loop and keyboard input handling
├── render.rs    # TUI rendering (file list, diff panes, layout)
├── diff.rs      # Diff computation engine (get_file_diff, change_region_offsets)
├── walker.rs    # Parallel directory walker (MultiVisitor)
└── config.rs    # Theme/color configuration

Dependencies

  • ratatui - Terminal UI framework
  • clap - CLI argument parsing
  • anyhow - Error handling
  • diffy - Diff generation
  • ignore - Fast file tree walking
  • rayon - Parallel data processing
  • crossterm - Cross-platform terminal manipulation

About

A high-performance, Terminal-based directory comparison tool built with Rust & Ratatui

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages