Skip to content

Instantly share code, notes, and snippets.

@koddsson
Last active February 17, 2025 17:03
Show Gist options
  • Save koddsson/daf81109cded9939d24e to your computer and use it in GitHub Desktop.
Save koddsson/daf81109cded9939d24e 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