DEV Community

Cover image for How integrate jira with my git branches with python
Andres 🐍 in 🇨🇦
Andres 🐍 in 🇨🇦

Posted on

How integrate jira with my git branches with python

At work I have some development ruls like:

Every change on code should be comes with a Pull request and the branch name should be named like ID of jira.

Then we have branches like this:

  $ git branch -a
  remotes/origin/DEV-118
  remotes/origin/DEV-120
  remotes/origin/DEV-123
  remotes/origin/DEV-130
  remotes/origin/DEV-133
  remotes/origin/DEV-137
  remotes/origin/DEV-141
....
Enter fullscreen mode Exit fullscreen mode

with that you don't know each branch what is it ... then lets make some fun:

With this you will receive:

DEV-XXX <Assigned Name> <Status> <Title> <url>

Now you can lost between branches and jira issues :>

output

is this the integration ? comeon zodman! show me more!

Ok ok Imagine you have assigned the ticket DEV-foo1

In git you do:

git checkout -b DEV-foo1

and start hacking .... when you finish and everything looks good. you should create the pull request then you type:


gh pr create -B dev --title "$(jira-list | grep $(git rev-parse --abbrev-ref HEAD))"

Enter fullscreen mode Exit fullscreen mode

PUM! you created a pull request with ID and title from jira.

if you don't know what is gh its a github cli

Top comments (0)