Last active
December 29, 2017 07:29
-
-
Save iamsaso/97fb79f3cb73de72434bb1d6fd872af4 to your computer and use it in GitHub Desktop.
.git/hooks/post-commit
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
#!/usr/bin/env bash | |
branch_name=`git symbolic-ref --short HEAD` | |
retcode=$? | |
non_push_suffix="_local" | |
# Only push if branch_name was found (my be empty if in detached head state) | |
if [ $retcode = 0 ] ; then | |
#Only push if branch_name does not end with the non-push suffix | |
if [[ $branch_name != *$non_push_suffix ]] ; then | |
echo | |
echo "**** Pushing current branch $branch_name to origin [post-commit hook]" | |
echo | |
git push origin $branch_name; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment