I have a pre-commit hook that's running a mysqldump to keep track of MySQL. I'm trying to add that dump to the commit, but for some reasons it won't.
The code:
#!/bin/sh
rm -f database.sql
exec "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --skip-comments -u root --password=password my-database > database.sql
git add database.sql
The file is created, but not added to the commit. Running TortoiseGit on Windows 7.
I don't know if it will help you, but here a step by step guide, how it works on my windows 10 machine with xampplite.
go to your project git
go to "hooks\\"
create file "pre-commit" (without file ending)
go to file properties and give full access to windows user
open pre-commit and paste:
#!/bin/sh
"C:\\xampplite\\mysql\\bin\\mysqldump.exe" -u dbuser -ppassword database_name > database_name.sql
git add database_name.sql exit 0
(-u username -ppassword databasename > file.sql)
file will be stored in project root. between -p and password is NO space.
Now, before every commit a mysql dump will be done and added to the commit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.