Create or open the file .git/hooks/pre-commit
and paste the following code inside it:
#!/bin/sh
mysqldump \
--no-data \
--dump-date=false \
--result-file=$PWD/dbdump.sql \
--log-error='/dev/null' \
--user='username' \
--password='password' \
'database-name'