Yes, usually you can just use defaults delete. If for example you have run defaults write -g NSScrollAnimationEnabled -bool false, you can undo the changes by running defaults delete -g NSScrollAnimationEnabled or defaults write -g NSScrollAnimationEnabled -bool true (and by reopening applications to apply the changes).

Even if the preference key had some value before you used defaults, it shouldn't matter if you delete the key. It is generally safe to delete preference keys or even complete files, and they can usually be recreated by OS X or applications.

The property lists modified by defaults are stored in directories like ~/Library/Preferences/, ~/Library/Containers/com.apple.mail/Data/Library/Preferences/, or ~/Library/Preferences/ByHost/. You can edit a plist in a text editor after converting it to XML with plutil -convert xml1.

Can I undo changes made via "defaults write"?
I have a 3 way switch that was wired incorrectly when the switches were replaced with a different color switch.  Is there a methodical way for me to identify which wires represent which piece of the system so I can correct the bad wiring?

Currently if switch 1 is on, switch 2 can turn light on or off.  If switch 1 is off, then switch 2 does nothing.
