a safer undo
mneumann at ntecs.de
Wed Jul 9 04:40:09 PDT 2008
Matthew Dillon wrote:
:I find myself the utility "undo" very dangerous, as it removes history.
:I'd instead suggest a soft-undo mode by default, which reverts to the
:last version of that file, but keeps the history, i.e. it overwrites the
:file with the content of the old. To really undo, there would be a "-f"
:(force) option, which removes forever the latest version and moves back
:to the last version.
:It's so easy to forget the "-d" if you want a diff output, and then, the
:file is gone.
:Other than that, a great utility. It's a great way to have version
:control for configuration files built-in from the very beginning.
Hmm. Doesn't it output to stdout by default? Are you telling it
to overwrite the original file with '-o <same_file_name>' ?
Even if you do the original isn't lost. Undo has no ability to
remove the file's history.
test# echo abc > x
test# echo def > x
Ah, I forgot to sync, so I guess the file hasn't reached the drive and
as such history was lost!
More information about the Kernel