On Sat, 18 Oct 2014 14:56:28 +0200, Bas Van Klinkenberg wrote:
If some simple versioning system was put into textmate, I would use it right away. The ability to show differences between versions would be great for things like HTML and CSS, and highlighting would make that easy.
First of all I agree with the others that learning git will be the best option and is not so frightening (if you stick to a basic workflow). You actually don't need a github or other remote account—you can just use it to keep track of local changes if you want, although you lose the benefit of having a remote backup and easy collaboration.
That being said, I also use the attached two TM commands for simple backup/versioning. The command "Save Document and Backup" runs every time you save your document, creating a new time-stamped copy at every save point. If you want to view an old copy the command "View Document Backups" brings up a HTML page listing all backups of that filename with links to open the file in TM. But, WARNING, **it's stupid**: it displays all files with the same filename. So if you have been editing lots of different files named index.html, and run the "View" command you'll see all backup files with this name in the list indiscriminately. But it works if you're in a pinch and need to recover an earlier version. The date-time included with the filename helps find the correct version.
You define where these backups go to by setting a variable in TextMate > Preferences > Variables (or inside a .tm_properties file), e.g.:
TM_BACKUP_DIR = '/Users/MYUSERNAME/.backup/textmate'
And make sure the directory exists.
Because many files will be created, you'll want to prune those older than a few months by adding this to your crontab (from the Terminal run `EDITOR=mate; crontab -e` and paste in the following two lines):
# Prune old textmate backup files, each day at 11am. 0 11 * * * find /Users/MYUSERNAME/.backup/textmate/ -mtime +180 -delete >/dev/null
Also note if you want to compare differences between two copies of a file there is a very useful command in the Diff bundle called "Document / Selection With Clipboard" that shows a useful comparison of changes.
Quinn