Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Place me in .git/hooks/post-checkout
- # Gets name from previous branch
- PREVIOUS_BRANCH=$(git name-rev --name-only $1)
- # Gets name from current branch
- CURRENT_BRANCH=$(git name-rev --name-only $2)
- if [ "${PREVIOUS_BRANCH}" != "${CURRENT_BRANCH}" ]; then
- echo "Coming from ${PREVIOUS_BRANCH} to ${CURRENT_BRANCH}"
- export PREVIOUS_NAME=$(basename `pwd`)_${PREVIOUS_BRANCH}
- export PROJECT_NAME=$(basename `pwd`)_${CURRENT_BRANCH}
- docker-compose -p ${PREVIOUS_NAME} stop
- docker-compose -p ${PROJECT_NAME} up -d
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement