FYI - I also filed a ticket on this page:
The instructions do not work when trying to link to the latest commit on a specific branch. It seems only master/main branches can be linked using the 'commitish' argument - if I try my branch name (feature/diagrams, even with the '/' escaped), I receive a 404 error.
This is a constant struggle as I try to share documentation and other work-in-progress files with team members, since the links are immediately stale as soon as I commit a new update to the file in question.
I believe this is due to a bug with the URL of branch names that contain a slash character:
If a branch name doesn't contain a slash, then its source code can be accessed via the link:
However, the link above will give a 404 for branches with a slash in their name. I believe this is the reason why the branch name you mentioned, feature/diagrams, doesn't work in your link.
The workaround in this case would be to replace the branch name in your link with the commit hash, however this means that the URL should get updated if there is a new commit that changes this file.
I would suggest adding yourself as a watcher in the public bug report (by selecting the Start watching this issue link) if you'd like to get notified via email on any updates. You can also select the This affects my team link to indicate you are affected by this issue
The last comment in the public bug report is from one of Bitbucket managers and mentions that our development team is working on this, but we don't have an ETA to share at the moment.
Thanks, @Theodora Boudale. Your explanation is perfect.
I've followed your advice to flag my team as affected, and I've added myself as a watcher on that bug.
Any chance the docs page could be updated also to reflect "/" characters not being supported?: https://support.atlassian.com/bitbucket-cloud/docs/hyperlink-to-source-code-in-bitbucket/
It is standard practice to group branches under a "somthing/" prefix, so it seems a pretty large omission to not have this called out in the docs.
Thanks very much for your quick response!
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
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