Last active
January 7, 2019 23:45
-
-
Save calebbrewer/5651654 to your computer and use it in GitHub Desktop.
This is for putting a MySQL DB under Git.
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
#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