Put the Current JIRA Issue in your Prompt

Your Git Branch Knows the Jira Ticket — So Should Your Prompt

Ever been neck-deep in code and momentarily forgotten what you’re supposed to be working on and felt like pivoting to something else (when you should finish what you started)?

Yeah, me too.

That’s why I made jira-git-issue — a lightweight command-line utility that shows the Jira ticket summary associated with your current Git branch. It’s built to drop right into your shell prompt so that ticket context is always right in front of you.

This was a “scratch-my-own-itch” project that came together fast with help from GitHub Copilot (thanks AI friend ✨).


What It Does

This script does exactly one thing, and it does it well:

It pulls the Jira issue summary from the ticket ID in your Git branch name and displays it — perfect for your terminal prompt.

It’s designed for branch naming patterns like this:

issue/jira/PROJECT-456

Then, using your Jira credentials (stored securely via a quick setup), it calls Jira’s API and prints the issue summary.


Why It’s Useful

You probably already name your branches after Jira tickets — but raw ticket IDs don’t tell the full story.

With jira-git-issue, your shell can now show:

Add email validation to login form

Right under your prompt, in real time.

It keeps you in flow. No switching tabs. No hunting through Jira. Just clean context, always visible.


How It Works

Here’s the quick rundown:

  • Parses the current Git branch to extract the Jira issue key
  • Queries Jira’s REST API using your registered API token
  • Displays the issue summary
  • Caches the result for fast repeat lookups

There’s also support for:

  • ✅ Multiple Jira domains
  • ✅ Per-repo configuration
  • ✅ Secure credential registration via CLI
  • ✅ Easy integration with custom prompts (like Oh My Posh)

Getting Started

1. Install it

git clone https://github.com/GigaFable/jira-git-issue
cd jira-git-issue
chmod +x jira-git-issue.py
cp jira-git-issue.py /usr/local/bin

2. Generate a Jira API token with the read:jira-work scope.

Create one at:
https://id.atlassian.com/manage-profile/security/api-tokens

3. Register your credentials

jira-git-issue.py --register-secrets yourdomain you@example.com your_api_key

yourdomain is the subdomain in your Jira URL (e.g. monkeyland if your Jira is https://monkeyland.atlassian.net)

4. Register your project

Inside your Git repo:

jira-git-issue.py --register-project yourdomain

Usage

To fetch and print the summary of the current Jira issue based on the current Git branch:

jira-git-issue.py --view-git-issue

You can drop this into your shell prompt to show it every time.


Example: Oh My Posh Prompt Segment

Here’s a custom block you can add to your Oh My Posh config:

{
  "alignment": "left",
  "newline": true,
  "segments": [
    {
      "type": "command",
      "style": "diamond",
      "background": "#341948",
      "foreground": "#EFDCF9",
      "trailing_diamond": "\ue0b4",
      "properties": {
        "script": "/usr/local/bin/jira-git-issue.py --view-git-issue",
        "shell": "bash"
      },
      "template": " \uE0A0 {{ .Output }} \uE0A0"
    }
  ],
  "type": "prompt"
}

And boom — your terminal becomes Jira-aware.


Final Thoughts

This isn’t some massive integration layer or plugin bundle — it’s just a lean Python script that respects your existing workflows.

  • No Jira plugin required
  • No Git hooks
  • Just the issue title where you need it

Check it out

github.com/GigaFable/jira-git-issue

MIT licensed. Fast, focused, functional.

Comments