Is there a way to revert to a specific version?

I recently implemented this and took a “git revert” approach rather than a “git reset; git push --force” approach. I created a new temporary document from the snapshot, instantiated an Y.UndoManager to track changes, then brought the snapshot up-to-date with the current document, then undid all those changes using the UndoManager, then brought the current document up-to-date with the temporary one.

This approach has the advantage that you don’t need to convince all the connected clients to suddenly reload the document from the server, it’s just treated as a regular update.

6 Likes