Skip to content

Git Integration

Several jtk commands auto-detect the Jira issue key from your current git branch. If you omit the issue key argument, jtk extracts it from the branch name.

  • jtk issues get
  • jtk issues transition <transition-name>
  • jtk issues comment <comment-text>
  • jtk worklogs list
  • jtk worklogs add

jtk calls git rev-parse --abbrev-ref HEAD to get the current branch name, then uses a regex to find a Jira issue key pattern ([A-Z]+-\d+).

Branch NameDetected Key
feature/PROJ-123-add-loginPROJ-123
bugfix/PROJ-456-fix-crashPROJ-456
PROJ-789PROJ-789
PROJ-100-quick-fixPROJ-100
feat/ABC-42-oauthABC-42
hotfix/DEV-1-urgentDEV-1
Branch NameResult
mainError: no issue key found
developError: no issue key found
feature/add-loginError: no issue key found
123-no-projectError: no issue key found
Terminal window
# Create a branch with a Jira key
git checkout -b feature/PROJ-123-add-oauth
# All of these auto-detect PROJ-123:
jtk issues get
jtk issues transition "In Progress"
jtk worklogs add --time 2h
jtk issues comment "Started implementation"

You can always provide an explicit issue key to override auto-detection:

Terminal window
# Even on branch feature/PROJ-123-something, this gets PROJ-456:
jtk issues get PROJ-456