Home > Software design >  How can I check if a commit exists in a pull request on GitHub?
How can I check if a commit exists in a pull request on GitHub?

Time:05-13

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?

CodePudding user response:

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.

CodePudding user response:

Yes, you can - with the gh 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:pr 123ab45 
  • Related