Skip to content

Instantly share code, notes, and snippets.

@MikaelPikael
Created September 30, 2016 13:10
Show Gist options
  • Save MikaelPikael/52d0953895ddb6aba7444cf3b4f349dd to your computer and use it in GitHub Desktop.
Save MikaelPikael/52d0953895ddb6aba7444cf3b4f349dd to your computer and use it in GitHub Desktop.
open JIRA based on git branch name bash function
function jira() {
if [ -z "$1" ]
then
# branch format SOME-JIRA-TASK-NBR_bla_bla
nbr=$(git rev-parse --abbrev-ref HEAD | sed "s/_.*//");
else
nbr=$1
fi
echo open JIRA: $nbr;
open https://telavox.atlassian.net/secure/QuickSearch.jspa\?searchString\=$nbr;
}
@MikaelPikael
Copy link
Author

Place in your e.g. .zshrc file

Then go to your git repo directory and type "jira" and it will open JIRA with task number parsed from your local git branch name.

NOTE: The branch should be named something like: JIRA-1234_fix_something_important

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment