File History
TatsuCode tracks every file edit during your session, allowing you to undo changes, view history, and revert to any previous state.
How It Works
Every time TatsuCode edits a file, it saves a snapshot of the content before the change. This creates a complete history that you can navigate at any time.
Original file
↓ Edit 1 (snapshot saved)
State after edit 1
↓ Edit 2 (snapshot saved)
State after edit 2
↓ Edit 3 (snapshot saved)
Current state
You can revert to any snapshot or the original state.
Undoing Changes
Undo Last Edit
> Undo the last edit to main.py
TatsuCode reverts the file to its state before the most recent edit.
Undo Multiple Edits
> Undo the last 3 edits to config.json
Or revert to the original state:
> Revert auth.ts to its original state
Undo by Confirmation
After edits, you can ask:
> Actually, undo that change
> Revert what you just did
Viewing History
File Edit History
See all edits made to a specific file:
> Show the edit history for utils.js
Output shows:
- Edit number
- Timestamp
- Line number affected (if applicable)
- Summary of change
Session Summary
See all files edited this session:
> What files have I edited this session?
> Show me a summary of all changes
Output includes:
- File paths
- Number of edits per file
- Line change statistics
Searching History
Find specific changes across all history:
> Search my edit history for "TODO"
> Find where I changed the database URL
This searches through all saved snapshots for matching content.
Practical Examples
Experimenting Safely
Try changes knowing you can always revert:
> Refactor this function to use async/await
> Hmm, that doesn't work with the existing code. Undo that.
Comparing Approaches
> Implement approach A
> Take note of the result
> Undo and implement approach B
> Which is better?
Recovering from Mistakes
> Oh no, that edit broke everything. Undo all changes to auth.ts
Reviewing What Changed
> What did we change in this session?
> Show me the history of changes to the API routes
How Revert Works
When you revert:
- TatsuCode finds the specified snapshot
- Restores the file to that content
- The revert itself is recorded in history
This means you can even "undo an undo" if needed.
Revert Options
By steps back:
> Undo the last 2 edits to main.py
To original state:
> Revert config.json to its original state
> Reset auth.ts to how it was before any edits
By state ID (advanced):
> Revert to state abc123
State IDs are shown in the history output.
Session Scope
File history is maintained per session:
- History starts when you begin a session
- History is preserved when you save/load sessions
- Starting a new session (
/new) begins fresh history
The history is stored in memory and session files, not in your project.
What's Tracked
Tracked:
- All edits made through TatsuCode
- Write operations (new files)
- Edit operations (modifications)
- Revert operations (so you can undo them)
Not tracked:
- Changes made outside TatsuCode
- Changes before the session started
- Binary file contents
Storage
History is stored in local session data:
- Location: user-local app data storage
- Format: compact snapshots
- Cleanup: old sessions can be removed via
/remove-tatsu
History doesn't persist in your project folder — it's separate from your code.
Best Practices
Save Before Big Changes
For major refactoring, consider:
> First, note the current state of the authentication module
> [Makes changes]
> If this doesn't work, I can undo all changes
Use Descriptive Sessions
Name sessions so you can find them later:
/session-rename "Experiment: New auth approach"
Review Before Reverting
Check what will change:
> Show me the history for this file first
> What was the original state?
Clean Up Failed Experiments
> Undo all changes to the test files
> Revert the config to its original state
Limitations
- Session scope only — History doesn't persist across TatsuCode restarts unless you save the session
- Memory-based — Very long sessions with many edits may use more memory
- Text files only — Binary files (images, executables) aren't fully tracked
- No external changes — Edits made outside TatsuCode aren't captured
Comparison with Git
| Feature | File History | Git |
|---|---|---|
| Granularity | Every edit | Commits |
| Setup | Automatic | Requires repo |
| Scope | Session | Project lifetime |
| Branches | No | Yes |
| Remote backup | No | Yes |
File History complements Git — use it for immediate undo during development, and Git for long-term version control.
Next Steps
- AI Capabilities — What TatsuCode can do
- Tools Reference — All available tools
- Commands — Slash command reference