git-diff-tui
v1.1.0
Published
tui app export git diff as file for web chat LLM context by vibe coding
Downloads
296
Maintainers
Readme
This app and this README file are generated by an LLM. I take no responsibility for them.
I won’t update this rubbish vibe-coding repo unless I want to add function to it, so there’s no need to leave feedback. Please fork it and edit it yourself.
git-diff-tui
A terminal user interface (TUI) tool that helps you manage Git changes and export them in various formats - perfect for sharing code context with LLMs like ChatGPT, Claude, or Gemini.
✨ Features
📋 Interactive Git Management
- Browse staged and unstaged files in a clean TUI
- Switch between flat and tree view modes
- Real-time diff preview with syntax highlighting
- Select multiple files for batch operations
📤 Export Capabilities
- Single/Multiple File Diffs - Export selected files' diffs to a single file
- File Overview - Generate a complete file structure with sizes (all Git-managed + untracked files)
- Code Dump - Export entire codebase with C++ header/source merging
- Flat mode: All files in one directory with path-encoded filenames
- Tree mode: Preserve original directory structure
- Auto-merge C++ pairs (
.h/.hpp+.cpp/.cc) - Include all other files (JS, TS, HLSL, etc.)
🎯 Perfect For
- Sharing code context with AI coding assistants
- Code reviews and documentation
- Creating portable code snapshots
- Analyzing project structure
- Vibe coding with LLMs
📦 Installation
# Install globally
npm install -g git-diff-tui
# Use any of these commands
git-diff-tui
gdt
gd🚀 Usage
# Run in any Git repository
cd your-project
gdt⌨️ Keybindings
Navigation
| Key | Action |
|-----|--------|
| ↑ / k | Move up |
| ↓ / j | Move down |
| PageUp | Jump up 10 items |
| PageDown | Jump down 10 items |
| Home | Jump to first item |
| End | Jump to last item |
View Control
| Key | Action |
|-----|--------|
| / | Toggle flat/tree view mode |
| Tab | Switch focus (file list ↔ diff view) |
File Selection
| Key | Action |
|-----|--------|
| Space | Select/deselect current file |
| a | Select/deselect all files |
Export Operations
| Key | Action | Description |
|-----|--------|-------------|
| e | Export single diff | Export current file's diff to ./diff.txt |
| E | Export multiple diffs | Export selected files' diffs (prompts for path) |
| f | Quick file overview | Export file structure to current directory |
| F | File overview (custom path) | Export file overview with path input |
| D | Code dump | Export entire codebase with merge (press Tab to switch flat/tree mode) |
Other
| Key | Action |
|-----|--------|
| r | Refresh file list |
| q / Esc | Quit |
📁 Export Formats
Diff Export (E)
./diff_20251228_213045.txtFile Overview (f / F)
./files_overview_20251228_213045.txt
[.]
- CMakeLists.txt (1.22 KB)
- README.md (2.45 KB)
[src]
- main.cpp (1.84 KB)
- utils.cpp (3.47 KB)
[src/components]
- button.cpp (1.55 KB)
- button.h (890 B)Code Dump (D)
Tree Mode (default):
./code_dump_20251228_213045/
├── app/
│ └── Game/
│ ├── scene_merged.cpp
│ └── game_object_merged.cpp
├── src/
│ └── utils.js
└── dump_summary.txtFlat Mode (press Tab to switch):
./code_dump_20251228_213045/
├── app_Game_scene_merged.cpp
├── app_Game_game_object_merged.cpp
├── src_utils.js
└── dump_summary.txt🎨 Path Input Features
When prompted for export path:
- Enter: Confirm and export
- Esc: Cancel
- Ctrl+V: Paste from clipboard
- Ctrl+U: Clear input
- Arrow Keys: Move cursor
- Home/End: Jump to start/end
Path Handling
- Empty input → Auto-generate timestamped filename in current directory
- Directory path → Auto-generate timestamped filename in that directory
- Full file path → Use as-is
💡 Use Cases
For AI Coding Assistants
# Export relevant diffs for LLM context
gdt
# Select files with Space, press E, paste to ChatGPT/Claude
# Export entire codebase structure
gdt
# Press f, share files_overview.txt with AI for architecture discussion
# Export full code for analysis
gdt
# Press D, select tree mode, share code_dump/ folder with AIFor Code Reviews
# Export changes for review
gdt
# Select modified files, press E, share diff fileFor Documentation
# Generate project file structure
gdt
# Press f to create overview🔧 Advanced Features
C++ Header/Source Merging
The tool automatically detects and merges C++ file pairs:
- Headers:
.h,.hpp,.hxx,.hh - Sources:
.cpp,.cxx,.cc,.c
Example output:
// ============================================================================
// 合併檔案: scene
// 原始路徑: app/Game
// Header: scene.h
// Source: scene.cpp
// ============================================================================
// -------------------- Header File: scene.h --------------------
#pragma once
// ... header content ...
// -------------------- Source File: scene.cpp --------------------
#include "scene.h"
// ... source content ...File Inclusion Rules
- ✅ All Git-tracked files
- ✅ Untracked files (not in
.gitignore) - ❌ Files in
.gitignore - ❌ Binary files (automatically handled by Git)
🛠️ Development
# Clone repository
git clone https://github.com/koolerkx/git-diff-tui.git
cd git-diff-tui
# Install dependencies
npm install
# Build
npm run build
# Link for local testing
npm link
# Test
gdt📝 License
Unlicense - Public Domain
This is free and unencumbered software released into the public domain. Anyone is free to use, modify, and distribute this software for any purpose, without any restrictions or attribution requirements.
