Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This is for putting a MySQL DB under Git.
#Pre-commit hook
mysqldump -uuser -ppassword --skip-extended-insert databaseName > /path/to/your/repo/database.sql
cd /path/to/your/repo
git add [database].sql
#Post-merge hook
mysql -u [mysql user] -p[mysql password] [database] < /path/to/your/repo/[database].sql
#If using wamp on Windows for local dev
#Be sure to check version numbers and db name.
C:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump.exe -uroot --skip-extended-insert dbName > c:\example.sql
C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe -uroot dbName < c:\example.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment