An open API service indexing awesome lists of open source software.

https://github.com/pronzzz/time-machine

A robust Terminal User Interface (TUI) for navigating and reverting Git states using the reflog. Built with Rust and Ratatui, it features visual timelines, live diff previews, and a "Safe Revert" mechanism that automatically stashes uncommitted changes before resetting.
https://github.com/pronzzz/time-machine

cli developer-tools git-reflog git-tools productivity ratatui rust terminal tui version-control

Last synced: 4 days ago
JSON representation

A robust Terminal User Interface (TUI) for navigating and reverting Git states using the reflog. Built with Rust and Ratatui, it features visual timelines, live diff previews, and a "Safe Revert" mechanism that automatically stashes uncommitted changes before resetting.

Awesome Lists containing this project

README

          

# time-machine ⏳

![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=for-the-badge&logo=rust&logoColor=white)
![Ratatui](https://img.shields.io/badge/Ratatui-%23000000.svg?style=for-the-badge&logo=rust&logoColor=white)
[![Crates.io](https://img.shields.io/crates/v/git-time-machine-tui?style=for-the-badge)](https://crates.io/crates/git-time-machine-tui)
![License](https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge)

**time-machine** is a robust, fail-safe Terminal User Interface (TUI) for navigating and reverting Git states via the reflog. It turns the intimidating wall of text that is `git reflog` into an interactive, visual timeline associated with a "Safe Revert" mechanism.

## 🚀 Features

### 1. Visual Reflog Timeline
- **Semantic Parsing**: Reflog messages are parsed into readable types (Commit, Checkout, Merge, etc.).
- **Relative Time**: Timestamps are shown as humans read them (e.g., "2h 30m ago").
- **Navigation**: intuitive Up/Down arrow navigation through your history.

### 2. Live Preview Engine
- **Diff Summary**: Instantly see a diff summary of the selected state relative to your *current* working directory.
- **Stats**: View "Files changed", "Insertions", and "Deletions" at a glance.
- **File List**: A concise list of modified files.

### 3. Safe Revert ("Time Travel")
- **Safety Stash**: The tool **automatically stashes** uncommitted changes before any revert action.
- **Fail-Safe**: Uses `git reset --hard` only *after* securing your current work.
- **Feedback**: Provides immediate confirmation of the revert and the location of your stashed changes.

## 🛠️ Installation & Usage

### Install via Cargo (Recommended)
```bash
cargo install git-time-machine-tui
```

### Build from Source
```bash
git clone https://github.com/pronzzz/time-machine
cd time-machine
cargo run
```

### Controls
| Key | Action |
| :--- | :--- |
| `↑` / `↓` | Navigate history |
| `Enter` | **Safe Revert** to selected state |
| `q` | Quit |

## 🏗️ Architecture

- **Language**: Rust 🦀
- **UI Framework**: [Ratatui](https://github.com/ratatui-org/ratatui)
- **Git Backend**: [git2-rs](https://github.com/rust-lang/git2-rs) (libgit2 bindings) for high-performance operations.

## 📜 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.