Skip to content

Instantly share code, notes, and snippets.

@LeZuse
Last active October 11, 2019 16:33
Show Gist options
  • Save LeZuse/d1604defc19942b46fde1aaa2b75260c to your computer and use it in GitHub Desktop.
Save LeZuse/d1604defc19942b46fde1aaa2b75260c to your computer and use it in GitHub Desktop.
GitHub PR view & checkout
# prerequisites: brew install fzf hub
function prss() {
hub issue --include-pulls --color \
--since=`date -u -v-1m +"%Y-%m-%dT%H:%M:%SZ"` \
--format="%Cyellow%i%Creset %t %Cwhite@%au%Creset %l %Cyellow%cr%Creset%n" | \
fzf --ansi --preview="echo {} | cut -d' ' -f1 | tr -d '#' | xargs -I % hub issue show %" | \
cut -d' ' -f1 | tr -d '#' | \
xargs -I {} sh -c 'git rev-parse --verify pr-{} || git fetch origin pull/{}/head:pr-{} && git checkout pr-{}'
}
@LeZuse
Copy link
Author

LeZuse commented Oct 11, 2019

TODO

  • checkout using the real branch name instead of pr-XXX

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