wit provides the most powerful undo capabilities of any version control system. Made a mistake? Just undo it.
undo
Undo the last operation(s). This is wit’s superpower.
Options
What Can Be Undone?
- Commits
- Branch creation/deletion
- Merges
- File staging
- And more…
Examples
Example Scenarios
Undo an accidental commit:
Undo branch creation:
Undo a merge:
history
Show the operation history (what undo uses).
Options
Examples
Example Output
restore
Restore files from the index or a commit.
Options
Examples
Difference from Git
uncommit
Undo commits while keeping changes staged.
Arguments
Examples
Use Cases
Fix a commit message:
Add a forgotten file:
For simpler cases, use wit amend instead:
reset
Reset the current HEAD to a specific state.
Options
Examples
wit reset --hard will permanently discard uncommitted changes. Use with caution!
Difference from uncommit
Comparison: undo vs uncommit vs restore vs reset
Decision Guide
- “I want to undo the last thing I did” →
wit undo
- “I want to redo my last commit differently” →
wit uncommit or wit amend
- “I want to discard changes to a file” →
wit restore <file>
- “I want to unstage a file” →
wit restore --staged <file>
- “I want to go back to a specific commit” →
wit reset [--hard] <commit>
Workflow Example