getting last commit before push of a specific build Edited


sometimes when working a user accumulates multiple local commits before pushing to the origin.

in that case, BITBUCKET_COMMIT will only point to the last one.

is it possible to somehow get the range of commits that triggered the build?

it is necessary for my team in order to determine which services changed during the last update and only build them.


in addition to that, better support for mono-repos could be really great.


1 answer

Ough, sorry, I thought this is discussion, not answer, so don't treat my post as answer please.


It's not totally correct heading of question. It's not commit range is required but the last commit hash BEFORE push happen.

So, idea is to check, manipulate only with files newely delivered by push triggered build. To be able to use something like `git diff --names-only ${BITBUCKET_PREVIOUS_COMMIT} HEAD`. Such functionality is highly demanded for CI server. Thanks.

I am looking for exact the same functionality!

Not only are you guys looking for this, it's also here


I find it kind of strange that Bitbucket Pipelines doesn't already have this functionality. I mean Travis CI has it (`TRAVIS_COMMIT_RANGE`), CircleCI somehow has it too and even Jenkins has something for this... I really prefer to stick with Pipelines to have an all-in-one power repo, but this kind of things really makes you think about using others...

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

29,950 views 26 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you