'How can I check if a commit exists in a pull request on GitHub?
So I have a list of commits SHAs to check. In a given commit SHA let's say 123ab45, I want to see if the commit is linked to a PR in the branch.
Is there any command that I can put to check that?
Solution 1:[1]
git
has no concept of "pull request". This is a feature that is added by services built on top of git
such as Github, Bitbucket, Gitlab, etc. There is no git
command to do what you ask. To do this you will need to use their tools and APIs. The exact solution here depends on which of these services you use.
Solution 2:[2]
Yes, you can - with the GitHub CLI version 2.7 or above:
gh search prs 123ab45
You could also use the search functionality on github.com
.
You can simply enter the full SHA (or at least the first 7 characters) into the Pull Request search bar, or navigate directly to the URL:
https://github.com/your-repo/pulls?q=is%3Apr+123ab45+
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Code-Apprentice |
Solution 2 |