Skip to content

Instantly share code, notes, and snippets.

@souhaiebtar
Last active December 10, 2020 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save souhaiebtar/81cf2c0d979ac183f0c060eda94a59d2 to your computer and use it in GitHub Desktop.
Save souhaiebtar/81cf2c0d979ac183f0c060eda94a59d2 to your computer and use it in GitHub Desktop.
[pre-commit git hook for DB] pre-commit git hook for DB #git #hooks #linux
#!/usr/bin/env bash
git --work-tree=../ --git-dir=../.git
now=$(date -Is)
cd ../laradock
docker-compose exec -T mysql mysqldump -u root --password=root project_db > ../public/DB/PROJECT-NAME_$now.sql
cd ../public
git add DB/PROJECT-NAME_$now.sql
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment