Even though you should always try to work in Photoshop nondestructively (using Smart Filters or the like), that is not always possible or you may forget to, say, transform the layer to a Smart Object. Well, it is possible to increase the number of steps Photoshop remembers (used in the History panel or when you press Command+Z) to up to a 1000. This will allow you to go back very far.
To do so, you have to navigate to the Preferences menu niched inside of the “Photoshop CC” menu or by pressing Command+K. Then, change the box named “History States” to a 1000 (the default is 50). You have to go inside of the “Performance” tab in order to see the correct parameters. Just be aware that this will take much more RAM than the default because Photoshop has to store 20 times more information.
A 1000 steps should ensure that you can go back as far as you want. I like this tip as it’s a nice way to add an extra layer of security while working in Photoshop.