Create local git branches based on a JIRA issue
Latest version: 0.1.0 see CHANGELOG.md for changes from previous versions
This script will query a JIRA server for the given issue key and create a git branch based on the issue type, key, and summary in the form of:
issuetype/ISSUE-1_issue_summary
It will also optionally trigger an issue transition in JIRA, e.g. "Start Progress".
Also included is an optional shell wrapper function that will prompt for your JIRA password and export it to an environment variable so you don't have to enter it every time within the same shell session.
pip install -r requirements.txt
In your .profile (or equivalent):
export JBRANCH_PATH="/path/to/jbranch
source "$JBRANCH_PATH/jbranch.sh"
python jbranch.py ISSUE-1
jbranch ISSUE-1
Force re-prompt for password:
jbranch -p ISSUE-1
There are a number of environment variables that can be set to control how jbranch functions.
JBRANCH_JIRA_URL
- the full url to the JIRA server
- example:
JBRANCH_JIRA_URL="https://my_jira.atlassian.net"
JBRANCH_JIRA_USERNAME
- the JIRA username with which to authenticate
- example:
JBRANCH_JIRA_USERNAME="[email protected]"
JBRANCH_JIRA_PASSWORD
- the JIRA password with which to authenticate
-
example:
JBRANCH_JIRA_PASSWORD="mysupersecret"
Please use common sense and don't set this in your .profile
JBRANCH_TRANSITION
- an optional JIRA transition to trigger on the issue
- example:
JBRANCH_TRANSITION="Start Progress"
JBRANCH_ALLOW_EDIT
- allow editing of the branch name before creation
- example:
JBRANCH_ALLOW_EDIT=1
JBRANCH_NO_COLOR
- don't use colors in output
- example:
JBRANCH_NO_COLOR=1
JBRANCH_LC_SUMMARY
- lowercase the JIRA issue summary in the branch name
- example:
JBRANCH_LC_SUMMARY=1
JBRANCH_LC_FIRST
- lowercase only the first letter of the JIRA issue summary in the branch name
- example:
JBRANCH_LC_FIRST=1
JBRANCH_NO_PREFIX
- disable branch name prefixing
- example:
JBRANCH_NO_PREFIX=1
JBRANCH_NO_SWITCH
- don't switch to the branch after it is created
- example:
JBRANCH_NO_SWITCH=1