DEV Community

Cover image for I got tired of the Jira Git PR ritual, so I automated it
Aashish Prasad
Aashish Prasad

Posted on

I got tired of the Jira Git PR ritual, so I automated it

The 5-minute tax on every task

If you use Jira and Git, you know this loop:

  1. Write your code
  2. Commit
  3. Open Jira in a new tab
  4. Click "Create" → fill in summary, description, component, work type, acceptance criteria
  5. Copy the ticket key
  6. git commit --amend to add it to your commit
  7. git checkout -b ticket_key && git push -u origin ticket_key
  8. Open the PR on GitHub
  9. Drag the ticket from "To Do" to "In Code Review"

Steps 3–9 take five minutes if everything goes smoothly. Multiply by 5
tasks a day, by your team size, by 200 working days. That's a lot of
human time spent moving a card on a screen.

What if it could be like this:

Enter commit-to-jira

npm install -g commit-to-jira
commit-to-jira setup    # one-time
commit-to-jira build    # every task
Enter fullscreen mode Exit fullscreen mode
$ commit-to-jira build

--- TICKET PREVIEW ---
Project:    PROJ
Summary:    build: Remove legacy payment adapter and feature flags
Commits:    2
  1. build: Remove legacy payment adapter and feature flags
  2. Remove org-level feature flags
Dev branch: development
----------------------

? Create Jira ticket, rewrite commits, open a PR, and move ticket to code review? Yes

Fetching your Jira account...
Fetching project metadata...
? Work type: Story
? Component: Frontend
? Acceptance Criteria: Satisfy all the requirements in the description

🚀 Creating Jira ticket...
✅ Jira ticket created: PROJ-1042

✏️  Rewriting 2 commit(s)...
  → build(PROJ-1042): Remove legacy payment adapter and feature flags
  → fix(PROJ-1042): Remove org-level feature flags
✅ Commits rewritten.

🌿 Creating branch: PROJ-1042
Switched to a new branch 'PROJ-1042'
remote:
remote: Create a pull request for 'PROJ-1042' on GitHub by visiting:
remote:      https://github.com/acme/my-app/pull/new/PROJ-1042
remote:
To https://github.com/acme/my-app.git
 * [new branch]      PROJ-1042 -> PROJ-1042
✅ Branch pushed: PROJ-1042

? PR base branch (enter to use "development"): development

📬 Opening GitHub PR...
✅ PR opened: https://github.com/acme/my-app/pull/87

🔄 Moving ticket to "CODE REVIEW"...
✅ Ticket moved to "CODE REVIEW".

🎉 All done! Ticket: https://yourcompany.atlassian.net/browse/PROJ-1042
Enter fullscreen mode Exit fullscreen mode

How it works

It runs git log @{-1}..HEAD to grab every commit you've made since
branching off, then walks you through three short prompts (work type,
component, acceptance criteria), creates the Jira ticket, rewrites your
commit messages to follow the conventional-commit-with-ticket-key format
via a non-interactive rebase, creates a branch named after the ticket,
pushes it, opens a PR, and transitions the ticket to your "code review"
status.

The clever bit is the commit rewrite — it spawns temporary shell scripts
as GIT_SEQUENCE_EDITOR and GIT_EDITOR, so the rebase happens with
zero terminal interaction even though it's interactive under the hood.

Conventional commits, automatically

Before After
fix: remove old route fix(PROJ-1042): remove old route
feat(auth): add SSO feat(PROJ-1042): add SSO
Update config file fix(PROJ-1042): Update config file

What if I don't use GitHub?

Skip the GitHub token in setup. The tool stops after creating the Jira
ticket and rewriting your commits — still useful.

Source / install

Would love to hear what's broken in your workflow that I should add.

Top comments (0)