$ undo.sh|

undo.sh

A shell script for reversing mistakes

git reset --soft

The gentlest undo. Your changes remain staged, your work is preserved. Only the commit pointer moves back. It is the undo that says: the work was correct, only the packaging was wrong.

$ git reset --soft HEAD~1
Unstaged commit. Changes preserved.

rm -rf mistakes/

The nuclear option. No recovery, no mercy. But sometimes, the cleanest undo is the most complete one. The directory is gone. The disk space is free. The mistake is a memory, not a file.

$ rm -rf mistakes/
WARNING: irreversible operation

ctrl+z && ctrl+z

Sometimes one undo is not enough. The repeated undo -- stepping back through history, state by state -- is the meditative practice of the terminal. Each step reveals what was, and in the revelation, teaches what should be.

$ undo --steps 5
Rewound 5 states. Current: state_042

exit 0

Every script ends. undo.sh terminates with exit code 0: success. The undo was performed. The system is clean. The terminal waits, cursor blinking, for the next command.

$ undo.sh --complete
All operations undone. Exit 0.