If I don't necessarily want to run all of the commands, I make a "do-nothing script" [1][2] that just echoes them out instead.
I don't have a generalized example of undo / redo in bash commands, since I don't believe it's possible, but for example, if I'm running a destructive command, I prefer to run the dry run version first, then have a confirmation prompt [3] before running the destructive action.