1. Bitbucket
  2. Public Issue Tracker
  3. master

Issues

Issue #7150 new

Option to replace the commit hash in URL with branch name when browsing source tree (BB-8297)

Edi Modrić
created an issue

Please see here for discussion:

https://answers.atlassian.com/questions/160170/bitbucket-urls-when-browsing-repos-always-contain-hash

tl;dr

It would be nice to provide an option to create URLs with branch name instead of commit hash when browsing the repo. For the most part, when I link to file or folder in the repo, I want the link to point to the latest commit in the branch, and not the specific one.

GitHub does it nicely by generating URLs like this: https://github.com/symfony/symfony-standard/tree/master/src

Comments (9)

  1. Brodie Rao

    Hi Edi,

    I agree that this would be nice to have. It's unfortunately not a trivial thing to do, as we have some issues around branch/tag names with slashes in them that we'd need to resolve before we do this.

    In the meantime, I've put an issue in our backlog. Hopefully we can look into it soon. Thanks for the report!

  2. Peter Bittner

    Just to make sure we're all on the same page,

    readable URLs (without commit hash) are working on Bitbucket. They look like this:

    https://bitbucket.org/{team-or-username}/{repo}/src/{branch-commit-or-tag}/{filename-or-path}#cl-{line-number}
    

    The line number bit, #...., naturally, is optional. So, there's not even a tree/ and blob/ part in the URL that bothers me on GitHub. Instead, it's always src/ here, the rest of the URL scheme is identical.

    Here is an Example:

    Any long, default URL, such as ...

    https://bitbucket.org/bittner/django-organice/src/d8819f8d9c52acd8c32e551a0340b7cde1ed498a/organice/settings.py?at=master#cl-4

    ... can be rewritten in this shorter, more beautiful, readable version ...

    https://bitbucket.org/bittner/django-organice/src/master/organice/settings.py#cl-4

    ... and it's working fine! (NOTE: the selected branch moves from the query string to the place where the commit hash is in the default URL scheme.)

    Left to Do

    The only thing that bothers now is that the shorter, beautiful URL scheme is not the default on Bitbucket. :-( Any plans on changing the default?

  3. Már Örlygsson

    It is super annoying to see that this fairly straightforward feature-request lies untouched for 2-3 years! ...like so many others.

    Please make this the default behaviour - unless you're waiting for someone to write a browser-extension to fix this on the client side. :-)

  4. JimNasby

    Yeah, this is extremely annoying. Github handles this correctly: by default you get "master" in the URL instead of the hash. This makes a LOT more sense for general usage!

  5. Log in to comment