Public
Snippet $2 authored by Joe Slam

git poor man's time machine

Edited
git-poor-mans-time-machine.sh
#!/bin/bash
###
# use git as a time machine for your e.g. Documents folder
# ----------------------------------------------------------
# this script commits all changes to branch master
# and creates a new branch DATE
# this new branch is the "landing point" for your timemachine.
#
# in order to "travel through time", just do a
#     $ git checkout DATE
# ...where DATE is the desired timestamp to travel to.
# Type
#     $ git checkout master
# to go back to present time.
#-----------------------------------------------------------
# run this script as a cronjob according to your desired interval.
#-----------------------------------------------------------
DATE=`date +"%Y-%m-%d_%H-%M-%S"`
cd /path/to/your/folder       # <= Change to your settings
git checkout master
git add *
git commit -m "snapshot of $DATE"
git branch $DATE