Skip to content

Instantly share code, notes, and snippets.

@juhasz
Created November 25, 2012 11:40
Show Gist options
  • Save juhasz/4143203 to your computer and use it in GitHub Desktop.
Save juhasz/4143203 to your computer and use it in GitHub Desktop.
Downloads and apply patches with git apply
#!/bin/bash
# apply patch with a remote patch file
if ! [ "$1" = "" ]; then
filename=/tmp/`echo $1 | sed -e 's/^.*\///'`
wget --output-document=$filename $1
if [ "${0##*/}" = "git-apply-remote" ]; then
# use git apply
git apply -v $filename
else
patch < $filename
fi
rm $filename
else
echo 'Please give an URL to patch'
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment