Created
January 3, 2019 20:00
-
-
Save researcx/21233a8756993e1f03972c1886eb865e to your computer and use it in GitHub Desktop.
Git auto-update
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
#!/bin/sh | |
REPO="https://github.com/<user>/<repo>" | |
PATH="/path/to/repository" | |
LATEST=`/usr/bin/git ls-remote $REPO refs/heads/master | /usr/bin/cut -f 1` | |
CURRENT=`/usr/bin/git -C $PATH rev-parse HEAD` | |
echo "Current Revision: $CURRENT" | |
echo "Latest Revision: $LATEST" | |
if [ "$LATEST" == "$CURRENT" ]; then | |
echo 'No updates found!' | |
exit | |
fi | |
/usr/bin/git -C $PATH pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment