Builtin Library
README.md
zm.restore
git restore.
zm.restore(path)takes the working edits on a path back to what it was staged or committed as: the stage where the path is staged, the last commit where it is not, and absence where it is neither. A folder takes every file beneath it back with it, and a deleted path comes back as its committed version. Edited bytes going back to a committed version are snapshotted to trash first (zm.trashlists them)..restores every path.- A scene's autosave overlay (
<scene>/scene_dirty/..., the live edits no save has written into the scene) goes back with any path that covers it: the scene, a folder above it, itsscene_dirtyfolder or one of its files, and.. zm.restore(path, { source = "HEAD~1" })takes the working content to that revision's version instead.zm.restore(path, { staged = true })unstages the path and leaves the working tree as it is;{ staged = true, worktree = true }does both.
Returns { restored, skipped, unstaged }; a path with nothing to restore is listed under skipped.