Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is for putting a MySQL DB under Git.
#Pre-commit hook
#!/bin/sh
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
#!/bin/sh
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.
#Dump
C:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump.exe -uroot --skip-extended-insert dbName > c:\example.sql
#Write
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