How to exit arbitrary mode x, as it seams for my particular case
undo-tree-mode there is no
undo-tree-mode related option for undoing it, it there a general solution?
undo-tree-mode is a buffer-local minor mode, so
M-x undo-tree-mode will toggle it in the current buffer.
Note that if you are in fact using
global-undo-tree-mode then that is a global minor mode which controls the buffer-local minor mode in all applicable buffers en-masse, and you would want to use
M-x global-undo-tree-mode to toggle that, if you wanted to disable the buffer-local mode in all applicable buffers.