Skip to content

Commit b58589d

Browse files
committed
Add script to retrieve a git diff by URL and apply to current dir.
1 parent f88cd35 commit b58589d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

git-apply-url

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
# Pastebin -> code.
4+
#
5+
# git apply-url https://gist.github.com/raw/.../...53b5
6+
# git apply-url http://paste.lisp.org/display/99999999/raw
7+
# etc.
8+
9+
URL=$1
10+
11+
function error {
12+
echo $*
13+
exit 1
14+
}
15+
16+
if [[ ! $URL ]]; then
17+
error $0 URL
18+
fi
19+
20+
if [[ -x $(which curl) && $(curl -V | grep https) ]]; then
21+
fetch="curl"
22+
elif [[ -x $(which wget) ]]; then
23+
fetch="wget -O - -q --no-check-certificate"
24+
else
25+
error need curl or wget
26+
fi
27+
28+
$fetch $URL | patch -p1

0 commit comments

Comments
 (0)