展开全部
pre-commit git hook
在你的repo根目录应该有个目录.git/hooks/ (需要先显示隐藏目录) , 在其中新建一个文件pre-commit(当前用户需要有执行权32313133353236313431303231363533e78988e69d8331333363373734限),内容大致如下:#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by"git commit"with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to"pre-commit".
/usr/local/opt/mysql/bin/mysqldump -uroot -p111111 -S /tmp/mysql-3306.socket dbname --no-data > path/to/dbfile/dbname.sql
git add path/to/dbfile/dbname.sql
上述mysql用户、密码、dbname都要变成你自己的。