Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Retrieve the commit hashes for a GitHub PR and output them on a single line. Suitable for use with git cherry-pick, etc.
$username=<your username>
$password=<your password>
$owner=<repository owner>
$pull_request_id=<pull request id to filter by>
curl --silent -u $username:$password$owner/$repo/pulls/$pull_request_id/commits \
| jq --raw-output '.[].sha' | tr '\r\n' ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.