Created
September 24, 2015 22:53
-
-
Save mohsin/0a6d1944cbd7815e58e7 to your computer and use it in GitHub Desktop.
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
function push() { | |
if [ -z "${1}" ]; then | |
echo "Usage: push <remote-name>" | |
return 1 | |
fi; | |
GIT_DIR_="$(git rev-parse --git-dir)" | |
BRANCH="$(git rev-parse --symbolic --abbrev-ref $(git symbolic-ref HEAD))" | |
PRE_PUSH="$GIT_DIR_/hooks/pre-push" | |
POST_PUSH="$GIT_DIR_/hooks/post-push" | |
test -x "$PRE_PUSH" && | |
exec "$PRE_PUSH" "$BRANCH" "$@" | |
git push "$1" "$BRANCH" | |
test $? -eq 0 && test -x "$POST_PUSH" && | |
exec "$POST_PUSH" "$BRANCH" "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment