Skip to content

Instantly share code, notes, and snippets.

@otsuarez
Created October 21, 2013 02:49
Show Gist options
  • Save otsuarez/7077991 to your computer and use it in GitHub Desktop.
Save otsuarez/7077991 to your computer and use it in GitHub Desktop.
check github commit id versions
#!/bin/bash
BRANCH=master
REPO=ansi-projects
USER=otsuarez
CMD_GITLOG='cd /usr/local/src/$REPO; git log | head -n1 | cut -f2 -d" "'
URL=https://api.github.com/repos/$USER/$REPO/git/refs/heads
github=`curl -s -H 'Accept: application/vnd.github.preview' -H "Authorization: token pc540face14f95acfc0089e53bfhck72a48s8c19" ${URL}/${BRANCH} -L | grep sha | sed 's/.* "\(.*\)",$/\1/'`
server1=`ssh server1 ${CMD_GITLOG}`
server2=`ssh server2 ${CMD_GITLOG}`
format="%-20s %-20s %s\n"
#printf "$format" "server1" "server2" "github"
printf "$format" "${server1:0:9}" "${server2:0:9}" "${github:0:9}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment