The Undo function allows you to revert an image a step back in the drawing or editting process. For example, if you paint a single stroke with the paintbrush on your image, clicking Undo will remove it. If you paint two strokes, releasing the mouse button or pen in between, you must Undo twice to undo both changes. If you want to undo multiple changes at once, you may prefer to use the Undo History dialog (Image Menu Dialogs Undo History...).
You can configure the number of undo levels (how many steps back you can take) in File Preferences... then Environment Levels of Undo. You can set this figure as high as you like, but you should note that every undo step takes up memory so keep this figure low if you don't have much memory.
Default Keyboard Shortcut: Ctrl-Z