In psychology undoing is a defense mechanism in which a person attempts to atone or erase some negative action, impulse, or idea by performing behaviors that are contrary or 'opposite' to the undesirable one. It is an attempt to 'undo' a negative or undesirable behavior by doing the opposite.
Undoing is essentially negating a previous behavior or thought viewed negatively by performing a behavior contrary to it. Sometimes undoing is used as a means of tacit apology.
For example, a couple gets into a big fight. The next day the person who started the fight feels bad about their previous negative behavior so they buy the other person something they have been wanting for awhile. Instead of directly apologizing the person is 'undoing' their previous negative behavior by doing something nice for their spouse. Undoing is also thought to be tied to some of the behaviors associated with a href="http://www.alleydog.com/glossary/definition.php?term=Obsessive-Compulsive+Disorder">obsessive compulsive disorder.
Individuals with OCD perform ritualistic behaviors (compulsions) in order to alleviate the distress associated with their recurrent and obsessive thoughts. So a person with OCD who has distressing and frequent thoughts about germ contamination (their obsession) might wash their hands repeatedly to the point that their hands are raw as a compulsive method of undoing the perceived germ contamination.
A famous example of undoing in literature is Shakespeare's Lady Macbeth who believes there is blood on her hands (due to her involvement in a murder) that cannot be removed and washes her hands repeatedly in an attempt to 'undo' her undesirable actions.