~/.zshrc
などに追加することで、ghprm {PRのnumber}
# copy GitHub PR's commit messages
function ghprm() {
local repo=$(git config --get remote.origin.url)
local orgAndRepo=$(echo $repo | sed -e 's/.*github.com\///' -e 's/\.git//')
local prNumber=$1
gh api -H 'Accept: application/vnd.github+json' /repos/$orgAndRepo/pulls/$prNumber/commits \
--template \
'{{range .}}
- {{.sha}} {{.commit.message}}{{end}}' | pbcopy
}
alias ghprm=ghprm