Skip to content

Instantly share code, notes, and snippets.

@battis
Last active August 29, 2015 14:05
Show Gist options
  • Save battis/598cdbbb36eecb979e4d to your computer and use it in GitHub Desktop.
Save battis/598cdbbb36eecb979e4d to your computer and use it in GitHub Desktop.
A handy little shell script to schedule with crontab to regularly commit the latest version of a web server to Github.
#!/bin/bash
logfile=/var/www/git.log
exec >> $logfile 2>&1
date +"%Y-%m-%d %r"
cd /var/www
git fetch -q origin
git merge origin/master
git submodule update --recursive
git add -A .
git commit -q -m 'Auto Backup'
git push -q origin master
echo "---"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment