Skip to content

Instantly share code, notes, and snippets.

@glauckner
Created June 6, 2013 16:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save glauckner/5722788 to your computer and use it in GitHub Desktop.
Save glauckner/5722788 to your computer and use it in GitHub Desktop.
Git pre commit hook to export database
#!/bin/bash
DBUSER="root"
DBPASS=""
DB="wordpress_bio"
SCHEMAPATH="__sql"
if [ ! -d "$SCHEMAPATH" ]; then
mkdir $SCHEMAPATH
fi
C:/xampp/mysql/bin/mysqldump -u $DBUSER --password=$DBPASS $DB > $SCHEMAPATH/$DB.sql
git add $SCHEMAPATH/$DB.sql
echo 'Exported and added Database to commit'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment