One of the great things about SharePoint Online lists and libraries is the concept of versioning. Every time you save a copy of the item, a new version is created. If necessary, you can go back to a prior version and make that the most current version. It used to be that versioning was not turned on by default, and you usually discovered that when you needed to recover something and it was too late. Now, SharePoint Online lists and libraries have versioning turned on by default. Here’s what that looks like…
Here I created a new list called “Versioning List” for lack of a better name. When I go into List Settings, I can view the Versioning settings for the list:

By default, versioning is turned on, and 50 versions of the list item will be saved. If you need to adjust that, just change the version number and click OK:

For SharePoint Online Document Libraries, the process is the same, but the default number of versions is 500.
For more information about versioning in SharePoint, check out this Versioning in SharePoint article.