Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting the destination commit SHA for a PR in Pipelines

Adam Fenton Community Leader Aug 05, 2020

Hi all,

Bitbucket Pipelines question here:

I'm trying to get the commit hash of the head of the destination branch of a PR. I can see the current commit is available in $BITBUCKET_COMMIT and the destination branch name is in $BITBUCKET_PR_DESTINATION_BRANCH, but how can I get the head commit of the destination branch?

I need this to fully take advantage of Happo for UI screenshot testing.

Thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted

Hi Adam,

You can use in your bitbucket-pipelines.yml file the following command, in order to get the hash of the last commit in the destination branch:


Please feel free to let us know if this works for you and if you need anything further!

Kind regards,

Adam Fenton Community Leader Aug 14, 2020

Perfect, this works nicely. Thank you Theodora!

You are very welcome, glad to have helped!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

441 views 4 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you