Created
October 14, 2013 16:36
-
-
Save rawzone/6978433 to your computer and use it in GitHub Desktop.
pre-commit hook for git to dumpt mysql database and add to repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DBUSER="<USERNAME>" | |
DBPASS="<PASSWORD>" | |
DB="<DATABASE>" | |
HOST="<DATABASE HOST>" | |
mysqldump -u $DBUSER -p$DBPASS $DB > db/$DB.sql | |
git add db/$DB.sql | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to .git/hooks/pre-commit to enable dump of database and adding it to the git repo before a commit (snapshotting the database)