Version control
In software engineering, version control (also known as revision control, source control, or source code management) is a class of systems responsible for managing changes to computer programs, documents, large web-sites, or other collections of information. Version control is a component of software configuration management.
— Wikipedia
Version control system track changes over the files and allow recalling a specific version of a file.
Modern developer tools can use multiple version control systems at the same time. For example GIT and vim’s built-in undo system (can be extended with undotree plugin).
I also use cloud based VCS services like GitHub and GitLab to store my source code, build artifacts and other files.