1

I have a repo stored on BitBucket and cloned locally, I want to know via command line if that repo has pull requests open in order to invoke that command via shell script. Do you know if that command exists?

  • 3
    Pull requests is not something that `git` by itself handles at all, but more a function of the hosting websites, such as github or bitbucket, does for you. I don't think you'll find any such command line tool unless someone has made an extension/plugin to git that handles a specific website, such as bitbucket. – Lasse V. Karlsen Mar 03 '17 at 18:39

1 Answers1

2

As @lasse-v-karlsen said pull requests are not git features. You could use the Bitbucket CLI or the Bitbucket API via a curl/wget request.

e.g.: The below will return a page of pull-request titles, with total no of pull-requests.

curl \
   https://api.bitbucket.org/2.0/repositories/{username}/{repo_slug}/pullrequests \
   | \
   jq "{ \
       pagelen: .pagelen, \
       size: .size, \
       titles: [.values[].title], \
       pageindex: .page \
   }"

I am using jq to parse json object

Libin Varghese
  • 1,506
  • 13
  • 19