If you work with a text editor like Microsoft Visual Studio (maybe also Eclipse, don't know), each text editor has its own undo/redo history.
However, when you perform refactoring - like renaming a function - this becomes an undo/redo on multiple files together, so in a sense these changes are part of a global history.
You can combine these two different kinds of mutations, and undo/redo still works as expected.
I don't know how hard this is to implement, but it looks like this problem is somehow is related to Darcs theory of patches (which I don't know yet :-)