Skip to content

Instantly share code, notes, and snippets.

@mrowe
Created October 9, 2014 03:39
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 mrowe/70a20dca77ba4496e35c to your computer and use it in GitHub Desktop.
Save mrowe/70a20dca77ba4496e35c to your computer and use it in GitHub Desktop.
Viewing GitHub pull request diffs
folder-hook REA 'macro pager \Cd '<pipe-message>~/dotfiles/mutt/view_git_patch.sh^M'
#!/bin/bash
if [ "$1" = "-p" ] ; then
type=patch
else
type=diff
fi
egrep "^http.*\.${type}$" \
| sed -e "s|git.realestate.com.au/|git.realestate.com.au/api/v3/repos/|" -e "s/pull/pulls/" -e "s/\.${type}$//" \
| xargs curl -s -H "Accept: application/vnd.github.VERSION.${type}" \
-H "Authorization: token $GITHUB_ACCESS_TOKEN" \
| colordiff \
| less -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment