Skip to content

Instantly share code, notes, and snippets.

@fsimonis
Created April 26, 2023 12:48
Show Gist options
  • Save fsimonis/5ccbfda8fdf9061e00c8268b617ec6cc to your computer and use it in GitHub Desktop.
Save fsimonis/5ccbfda8fdf9061e00c8268b617ec6cc to your computer and use it in GitHub Desktop.
Script using FZF and gh-cli to interactively checkout a PR. PR number and title are fuzzily searched using fzf
#! bash
# Created by Frédéric Simonis
# May it bring you joy and preserve your sanity
if [ $# -eq 0 ]; then
gh pr list -L 999 --json number,title -t \
'{{range .}}{{tablerow (printf "#%v" .number | autocolor "green") .title}}{{end}}' \
| fzf --ansi \
| sed "s/^#\([0-9]\+\).*/\1/" \
| xargs gh pr checkout
else
gh pr checkout $@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment