undo
v0.1.0+Restore all branches to their state before the last sync operation.
rung undoAliases
Section titled “Aliases”rung un— shorthand forrung undo
What It Does
Section titled “What It Does”When you run rung undo:
- Finds the most recent backup in
.git/rung/backups/ - Restores each branch to its backed-up commit
- Deletes the used backup
Example
Section titled “Example”# After a sync went wrong$ rung undo
✓ Restored feat-add-user-model to abc1234✓ Restored feat-add-user-api to def5678✓ Restored feat-add-user-tests to ghi9012✓ Removed backup 1704067200When to Use Undo
Section titled “When to Use Undo”- A sync introduced unexpected issues
- You want to restore branches after resolving conflicts differently
- You need to go back to a known good state
Backup Storage
Section titled “Backup Storage”Rung stores backups in .git/rung/backups/:
.git/rung/backups/└── 1704067200/ ├── feat-add-user-model # Contains: abc1234... ├── feat-add-user-api # Contains: def5678... └── feat-add-user-tests # Contains: ghi9012...Each file contains the commit SHA that branch pointed to before sync.
Limitations
Section titled “Limitations”- Only the most recent sync can be undone
- Cannot undo a
rung mergeoperation - Cannot undo if you’ve made commits after syncing
No Backup Available
Section titled “No Backup Available”If there’s no backup to restore:
$ rung undoNo backup found. Nothing to undo.This happens when:
- No sync has been performed yet
- The backup was already used for an undo
- Backups were manually deleted
Alternative: Abort
Section titled “Alternative: Abort”If you’re in the middle of a sync with conflicts, use --abort instead:
# During a sync with conflictsrung sync --abortThis is different from undo:
sync --abort— Cancels an in-progress syncundo— Reverses a completed sync
Related Commands
Section titled “Related Commands”sync— The operation that creates backupssync --abort— Abort in-progress syncdoctor— Check for backup availability