You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Output merge commit hash for Merged PR's in gh pr view #2306
Describe the feature or problem you’d like to solve
I'm looking to automate a task where I document specific merged PR's in another system. I can obtain the author, PR number, and PR title by parsing the current output of gh pr view 123. I can derive the PR link from the PR number (I already know the repo.)
The information I'd like to have available is the commit hash representing the merge commit created when the PR was squashed and merged.
Proposed solution
For a PR with status Merged, append the merge commit hash in the status string of gh pr view:
$ gh repo clone gobridge/gopher
$ gh pr view 31
post alternate platform song links
Merged in 22090be • therealplato wants to merge 6 commits into master from songlink
I want to hear posts in #howplaying without creating a spotify account or <snip>
Additional context
I only use squash and merge. I'm not sure if other options would break this approach.
Is it possible to get the merged PR hash for a merged PR in the UI ?? I have not been able to find this anywhere. I am reduced to searching the repo list-of-commits every time I have to do a cherrypick to another branch, and this is a big productivity-killer for cherry-picks.
Activity
dwgillies-bluescape commentedon Apr 13, 2022
Is it possible to get the merged PR hash for a merged PR in the UI ?? I have not been able to find this anywhere. I am reduced to searching the repo list-of-commits every time I have to do a cherrypick to another branch, and this is a big productivity-killer for cherry-picks.
samcoe commentedon Apr 14, 2022
@dwgillies-bluescape You can use
gh pr view --json mergeCommitto retrieve the merge commit SHA.dwgillies-bluescape commentedon Apr 14, 2022
Yes, I understood that your gh command works, but only :
It's not a very useful feature. stamping the commit itself on the website itself would be far more useful.