Since we follow the branch naming scheme {type}/{jira Issue}-{description} when naming branches related to Jira issues, we should be able to use a regular expression to extract the Jira issue and open this issue in the browser.
Example branch names
feature/sf-123-add-new-button
bug/tmnt-987-remove-infinite-loop
chore/sf-456-remove-copyright-infringement-in-example
Jira Subdomain
Since Jira issues can exist in different Jira instances, the subdomains associated with the ticket may be different.
e.g.
https://ferrarello.atlassian.net/browse/sf-123
https://mirage.atlassian.net/browse/tmnt-987-remove-infinite-loop
https://ferrarello.atlassian.net/browse/chore/sf-456
To handle this, we can create a Git config value (salcode.jiraSubdomain ).
By using a Git config value, we can set a global value but then override it for specific directories or projects.
e.g. in the Global .gitconfig
[salcode]
jiraSubdomain = ferrarello
but then in we could have a local .gitconfig that sets
[salcode]
jiraSubdomain = mirage
The global value could be set on the command line with the following (where ferrarello is the subdomain to be used globally).
git config --global salcode.jiraSubdomain ferrarello