Last active
March 24, 2017 09:09
-
-
Save dbilovd/bef9e310bfb6bc94ae00344516cdd0cf to your computer and use it in GitHub Desktop.
Git Hooks
This file contains hidden or 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 | |
# | |
# | |
# | |
# To enable this hook, rename this file to "post-commit". | |
echo "Running Post-Commit hook: Push immediately to master after commits" | |
# Get current branch | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
# Merge into and push master | |
if [ $branch == "dev" ]; then | |
git push origin dev | |
git checkout master | |
git merge dev | |
elif [ $branch == "master" ]; then | |
echo "Already in master branch" | |
fi | |
git pull origin master | |
git push origin master | |
git checkout dev | |
echo "Completed: pushing after commit" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment