Skip to content

Instantly share code, notes, and snippets.

@thefinn93
Created September 8, 2013 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefinn93/6489642 to your computer and use it in GitHub Desktop.
Save thefinn93/6489642 to your computer and use it in GitHub Desktop.
git updater.
#! /bin/bash
TOKEN=xxx
cd $1
branch=$(git describe --contains --all HEAD)
if [ "`git ls-remote origin -h refs/heads/$branch | cut -c1-40`" != "`cat .git/refs/heads/$branch`" ];
then
BASENAME=$(basename $1)
HOSTNAME=$(hostname)
git pull
curl "https://www.thefinn93.com/push/send?token=$TOKEN&title=Updated%20$BASENAME%20on%20$HOSTNAME&message=Updated%20$BASENAME%20on%20%$HOSTNAME%20to%20$(cat .git/refs/heads/$branch)"
if [ -x "./update" ]; then
./update
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment