Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save filipedfs/00a87a268563927fc2c215fc92067cad to your computer and use it in GitHub Desktop.

Select an option

Save filipedfs/00a87a268563927fc2c215fc92067cad to your computer and use it in GitHub Desktop.
Runs a `post-push` hook after a successful run of `git push`
git() {
ROOT="$(/usr/bin/git rev-parse --show-toplevel)"
LOCATION="/.git/hooks/post-push"
if [ "$1" == "push" ] && [ -f "$ROOT$LOCATION" ]; then
/usr/bin/git $* && eval $ROOT$LOCATION
else
/usr/bin/git $*
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment