Skip to content

Instantly share code, notes, and snippets.

@etoews
Last active April 12, 2017 22:04
Show Gist options
  • Save etoews/0d3b57cc6c5fe4dca290b2bbcd75b8db to your computer and use it in GitHub Desktop.
Save etoews/0d3b57cc6c5fe4dca290b2bbcd75b8db to your computer and use it in GitHub Desktop.
remote-diff: a bash function to diff a local file with a remote file
# Usage: remote-diff foo.yaml https://raw.githubusercontent.com/some-org/some-repo/master/foo.yaml
# Note: It ignores lines that begin with a '#' (comments)
function remote-diff()
{
FILE=${1}
FILENAME=$(basename ${FILE})
TMP_FILE="/tmp/${FILENAME}"
REMOTE_FILE=${2}
wget --quiet ${REMOTE_FILE} --output-document ${TMP_FILE}
diff --ignore-matching-lines ^# ${FILE} ${TMP_FILE}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment