4

I am working on a full Atlassian suite, jira stash/git and bamboo.

Does anyone know if there a way to list the PR's for my current branch?

I need to get find out from shell if my current branch has an open PR and find it's ID if one exists. No need to create a pr, as this will be done by the dev. Any suggestions are welcome.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Tancho
  • 1,581
  • 3
  • 22
  • 40
  • As PR would be a repository hosting feature, I believe Git could not be able to realize that. Maybe with some third party tool or addon – everton Jun 21 '16 at 01:14
  • 2
    Did you look at the stash API? –  Jun 21 '16 at 05:15

3 Answers3

12

Get the open pull requests from Bitbucket/Stash using:

$ git fetch origin 'refs/pull-requests/*:refs/remotes/origin/pull-requests/*'

Check the pull-requests that are on the current branch:

$ git branch --all --contains
  remotes/origin/pull-requests/31/from
  remotes/origin/pull-requests/31/merge

Clean up with:

$ git remote prune origin
roccotigger
  • 121
  • 4
2

There's the commercial BobSwift of commercial CLI addons for the entire Atlassian suite.

For Bitbucket there's: getPullRequest and get PullRequestList.

I think it's $10 for 1-10 users, in line with the usual "get people hooked" pricing policy for small and indie dev shops.

Marakai
  • 1,163
  • 11
  • 26
2

You can use Stash' (or Bitbucket's) REST API to get information about the pullrequests for a repository:

That way you can implement your own script (bash with curl, java, groovy, python, ...) to get the info you need.

General info about the REST APIs is available here.

GlennV
  • 3,471
  • 4
  • 26
  • 39