Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Add 'git jira' command #118

Open
salcode opened this issue Jul 5, 2020 · 0 comments
Open

Add 'git jira' command #118

salcode opened this issue Jul 5, 2020 · 0 comments

Comments

@salcode
Copy link
Member

salcode commented Jul 5, 2020

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
salcode added a commit that referenced this issue Jul 5, 2020
The "git jira" command parses the branch name to determine the Jira
issue based on the naming schedule
{branchType}/{issue}-{description}
e.g. feature/sf-123-add-new-button (the issue number is "sf-123")

The git jira command uses this issue number in combination with the
custom git config value stored at 'salcode.jiraSubdomain' (in my example
this value is "ferrarello") to construct a
URL like

https://ferrarello.atlassian.net/browse/sf-123

and open this URL in the browser.

See #118
salcode added a commit that referenced this issue Jul 5, 2020
The "git jira" command parses the branch name to determine the Jira
issue based on the naming schedule
{branchType}/{issue}-{description}
e.g. feature/sf-123-add-new-button (the issue number is "sf-123")

The git jira command uses this issue number in combination with the
custom git config value stored at 'salcode.jiraSubdomain' (in my example
this value is "ferrarello") to construct a
URL like

https://ferrarello.atlassian.net/browse/sf-123

and open this URL in the browser.

See #118
salcode added a commit that referenced this issue Jul 5, 2020
The "git jira" command parses the branch name to determine the Jira
issue based on the naming scheme
{branchType}/{issue}-{description}
e.g. feature/sf-123-add-new-button (the issue number is "sf-123")

The git jira command uses this issue number in combination with the
custom git config value stored at 'salcode.jiraSubdomain' (in my example
this value is "ferrarello") to construct a
URL like

https://ferrarello.atlassian.net/browse/sf-123

and open this URL in the browser.

See #118
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant