Created
June 13, 2017 00:20
-
-
Save nad2000/180403819bbdb08d77b1c604f68ace4b to your computer and use it in GitHub Desktop.
git post update hook that switches over to the pushed branch, updates the working directory and restarts the docker. It should be copied to .git/hooks/post-update
This file contains 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
#!/bin/sh | |
## post-update hook recieves a list of all updated refs | |
for r in "$@"; do | |
case $r in | |
refs/heads/*) git --work-tree=$HOME --git-dir=$HOME/repo.git checkout -f $(git rev-parse --symbolic --abbrev-ref $r) | |
esac | |
done | |
cd $HOME | |
docker-compose restart | |
docker-compose logs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment