Bitbucket URLs when browsing repos always contain hash

Hi,

When browsing (git) repos on BitBucket, the URL you get contains the commit hash, like this:

https://bitbucket.org/USERNAME/REPO_NAME/src/356a192b7913b04c54574d18c28d46e6395428ab/FOLDER_1/FOLDER_2?at=master

I'm aware that you can replace the commit hash with branch name to always get the latest version of the folder/file in the repo, but what bothers me is that that type of URL is not the default one when browsing.

I mean, most of the time when you link to repo, you want the URL to point to the latest commit in specific branch.

Is there a setting for that, or do I have to write to Atlassian and submit a feature request?

Thanks!

3 answers

1 accepted

Edi,

There isn't a setting for controlling where the repo URL points. You'd need to submit a request as you suspected. There are a couple of REST APIs that would let you construct the value yourself.

https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/changesets/

Mary

@Eddie Yes, I suppose that's the usecase too :) Option would be nice, certainly.

@Mary Thanks, I submitted the feature request: https://bitbucket.org/site/master/issue/7150/option-to-replace-the-commit-hash-in-url

I don't understand why this feature request only has 6 votes on Bitbucket. It's a real pain editing the URL everytime you want a reference to the latest version of a source file (e.g. linking to it from Confluence). Please vote for #7150! (https://bitbucket.org/site/master/issue/7150/option-to-replace-the-commit-hash-in-url)

Probably not the answer you want, but I think it is important for the stateless nature of the site to use the commit hash.

If I wanted to share the link with someone, or bookmark a page, using the commit hash ensures when I go back 2 days, or 2 years from now the code is the same.

That being said, I could certainly see value in a "latest" permalink option somewhere (although I guess that wouldn't be "perma" anyway as its content would chaneg over time..)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,011 views 1 5
Read article

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