I'm trying to find a past pull request to see which comments / actions were made on a particular issue.
I know the file and the change, so I can get to the commit that introduced it by looking at the blame view. However I can't find a way to look at the pull request that pushed that commit to the branch for the first time.
Is there a way to do this? Or do I have to go on a trip down memory lane and manually browse through past pull requests?
You can just go to GitHub and enter the SHA into the search bar, make sure you select the "Issues" link on the left. Via the GitHub UI there is a now a really easy way to do this. If you are looking at a commit in the list of commits in a branch in the UI, click on the link to the commit itself.
Open TerminalTerminalGit Bash. Fetch the reference to the pull request based on its ID number, creating a new branch in the process. At this point, you can do anything you want with this branch. You can run some local tests, or merge other branches into the branch.
The issue and pull request must be in the same repository. On GitHub.com, navigate to the main page of the repository. Under your repository name, click Pull requests. In the list of pull requests, click the pull request that you'd like to link to an issue.
You can filter your pull requests based on the commit SHA - see here
If you know the specific SHA hash of a commit, you can use it to search for pull requests that contain that SHA. Note that the SHA syntax must be at least seven characters.
For example:
e1109ab Matches pull requests with a commit SHA that starts with
e1109ab
.
0eff326d6213c is:merged Matches merged pull requests with a commit SHA that starts with
0eff326d6213c
.
GitHub has recently added an easier way to do this to their GraphQL API: https://developer.github.com/v4/changelog/2019-03-08-schema-changes/.
Here's an example query which demonstrates how to fetch associated pull requests of the five latest commits on the master branch:
{
repository(name: "react", owner: "facebook") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
nodes {
id
associatedPullRequests(first: 10) {
edges {
node {
title
}
}
}
}
}
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With