Believe it or not, you can “paint” an undo (as long as you haven’t resized your image or changed its color mode from RGB to CYMK or something like that, because in that case, it no longer works). You do this using the History Brush tool (Y; its icon looks like a brush with a circular back arrow, subtly indicating that you’re going “back in time”). You just grab it, paint over an area, and it returns that area to how it looked when you first opened the image (how cool is that?). If, when you go to paint, it gives you an “oh no you don’t!” icon, it means you did something to the image (resized it, cropped it, etc.) that precludes it from painting back to the original state you opened the image in. So, you’re out of luck in that case.
By default, the History Brush tool paints back to how your image looked when you opened it, but if you open the History panel (under the Window menu), you can click to the left of any of your last 20 edits and paint from that point in time instead. Lastly, if at any time in your editing process you think you might want to paint back to a particular point in your list of edits, click on the Create New Snapshot icon (it looks like a camera) at the bottom of the History panel to create a snapshot of what your image looks like at that moment. Now you don’t have to worry about only going back 20 steps in time—you can paint back to what your image looked like in that snapshot any time.
18.118.217.168