Git Repository Walkthrough
output2.mp4
An interactive shell utility to navigate through git commits and view diffs between them. Perfect for understanding repository history, reviewing changes, or exploring unfamiliar codebases.
Features
- Interactive Navigation: Navigate through commits using arrow keys
- Diff Viewing: View changes between commits as uncommitted files in VS Code
- Toggle Diff Mode: Switch between viewing commits and viewing diffs
- State Preservation: Automatically restores your original git state when exiting
- Visual Feedback: Color-coded output for better user experience
Installation
Install globally via npm:
npm install -g git-walkthrough
Or use with npx (no installation required):
Usage
Navigate to a directory containing a git repository and run:
Or if running locally:
Controls
- → (Right Arrow): Move to the next commit (or show diff if diff mode is on)
- ← (Left Arrow): Move to the previous commit (or show diff if diff mode is on)
- d: Toggle diff mode on/off
- q: Quit and restore original state
How It Works
- The script saves your current git state (branch and commit)
- It checks out the first commit in the repository history
- You can navigate through commits using arrow keys
- Press 'd' to toggle diff mode on/off
- When diff mode is ON, arrow keys show diffs between commits as uncommitted changes
- When diff mode is OFF, arrow keys navigate between commits normally
- The diff is shown as uncommitted changes that you can view in VS Code
- When you quit, your original state is automatically restored
Requirements
- Bash shell
- Git repository
- VS Code (for viewing diffs)
Safety Features
- Automatically restores original git state on exit
- Prevents navigation beyond available commits
- Validates that you're in a git repository before starting