Last active
November 18, 2017 00:03
-
-
Save blachniet/955ba45920f4d8461bb43d120c10eb13 to your computer and use it in GitHub Desktop.
Git post-update hook: After $TARGET_REF is pushed, write the contents of $FILE to $DEST.
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
#!/bin/sh | |
# | |
# After $TARGET_REF is pushed, write the | |
# contents of $FILE to $DEST. | |
# | |
# To enable this hook in a bare git repo | |
# 1. place it in the hooks/ directory | |
# 2. rename it to "post-update" | |
# 3. chmod +x post-update | |
TARGET_REF=refs/heads/master | |
FILE=README.md | |
DEST=/tmp/README.md | |
for ref in "$@" | |
do | |
if [[ $ref == $TARGET_REF ]]; then | |
echo "'$TARGET_REF' updated, copying '$FILE' to '$DEST'" | |
git show $TARGET_REF:$FILE > $DEST | |
echo "Done" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment