I need to find the solution of the exact situation, that has been described in the question.
I only have a feature Branch ID, for which I need to get the Pull Request ID or Url, on GitBash(2.20.1) or Terminal without calling Github API..
I have already tried this, but it doesn't work for every Branch or always, don't know why.
git ls-remote origin 'pull/*/head' | grep -F -f <(git rev-parse HEAD) | awk -F'/' '{print $3}'
but it doesn't work for every Branch or always,
That would be because:
Instead of grepping, try and check if the PR branch HEAD is part of your current branch history.
See "How to list branches that contain a given commit?"
git fetch origin +refs/pull/*/head:refs/remotes/origin/pr/*
git branch -a --contains <commit>
If you any /pull/ branches, you will get the PR you want.
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