Skip to content

Instantly share code, notes, and snippets.

@alexander-bauer
Created November 12, 2016 18:09
Show Gist options
  • Save alexander-bauer/0f6d2768b5c40b1e156e8f054bb50494 to your computer and use it in GitHub Desktop.
Save alexander-bauer/0f6d2768b5c40b1e156e8f054bb50494 to your computer and use it in GitHub Desktop.
Git post-receive hook for updating a non-bare repository when pushed to
THISFILE="$(pwd)/$0"
REPODIR=$(dirname $(dirname $(dirname "$THISFILE")))
# Notify the user that we are updating HEAD.
echo -e "\033[32m"
echo "Updating HEAD for you."
echo git --git-dir "$REPODIR/.git" --work-tree "$REPODIR/" reset --hard master
echo -e "\033[0m"
git --git-dir "$REPODIR/.git" --work-tree "$REPODIR/" reset --hard master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment