Created
November 28, 2017 15:56
-
-
Save settermjd/5585b898ce4c795c35d5d0e2b563adf3 to your computer and use it in GitHub Desktop.
Retrieve the commit hashes for a GitHub PR and output them on a single line. Suitable for use with git cherry-pick, etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
$username=<your username> | |
$password=<your password> | |
$owner=<repository owner> | |
$repo=<repository> | |
$pull_request_id=<pull request id to filter by> | |
curl --silent -u $username:$password https://api.github.com/repos/$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