Although Shopify has a variety of ways you can duplicate or download your theme files for backup purposes, sometimes this can be a bit time consuming.
One easy way to make a quick backup of a file you're about to modify (which is always recommended) is to highlight all of the code and copy and paste it into a plain text file. Windows users can use Notepad or a similar program, while Mac users will find TextEdit helpful for this.
This strategy is particular effective when editing CSS, JavaScript or JSON files because Shopify doesn't track the version history of these types of files.
It's important, however, that you ensure your text editor is set to plain text mode to prevent any unexpected modifications. Also, it's a good idea to turn off any "smart quote" or autocorrect features in the text editor to prevent the program from automatically changing your code.
This approach works well with Liquid, JavaScript, CSS and JSON files.
Once you have your code in the text document, you can begin editing the code in the Shopify editor. If you run into issues and need to rollback, you can just copy and paste the code from your text file back into the theme editor and save.
Another good strategy is to save the text files you create with the date and time you created it to a specific folder on your computer. This will let you quickly look back and access backup copies.