Skip to content

Instantly share code, notes, and snippets.

@nbibler
Last active September 4, 2018 13:44
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 nbibler/a72ed924382ee193bf63dc33823e006b to your computer and use it in GitHub Desktop.
Save nbibler/a72ed924382ee193bf63dc33823e006b to your computer and use it in GitHub Desktop.
Query a server's Rapporteur (or other) revision and compare it to the local git revision
#!/bin/bash
set -e
status_url=$1
local_revision=$(git rev-parse HEAD)
printf "%40s %-20s\n" $local_revision "Local"
remote_revision=$(curl --compressed --get --silent "$status_url" | jq --compact-output --monochrome-output '.revision' | tr -d '"')
printf "%40s %-20s\n" $remote_revision "Remote"
if [ "$remote_revision" == "$local_revision" ]
then
echo "Versions are identical. No difference."
else
git l $remote_revision...$local_revision
fi
@nbibler
Copy link
Author

nbibler commented Aug 16, 2017

Called with:

diff-to-release.sh "https://my.server.url/status.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment