Automatic branch creation on bitbucket

sunisgcet October 14, 2019

i can manually create a branch on jira using same issue name. but i need to automatically create branch on bitbucket using the same issue name jira. can anyone help me this .

Thanks in advance.

1 answer

1 accepted

0 votes
Answer accepted
Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 14, 2019

HI @sunisgcet 

To automate the branch creation in bitbucket you need to work with workflow triggers.

Please have a look at the below Atlassian article for details.

https://confluence.atlassian.com/adminjiracloud/configuring-workflow-triggers-776636696.html

sunisgcet October 14, 2019

Hi @Yogesh Mude Thanks for ur response. I will refer this site.

sunisgcet October 15, 2019

hi @Yogesh Mude i tried commit created trigger it works but in that  how can i execute branch created trigger. in which transition i can use that branch created trigger and how can i configure it. if you know any reference links means please let me know.

Thanks in advance.

Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2019

HI @sunisgcet 

For example, let say...you have the sample workflow like...ToDo --> In Progress --> Done

Whenever the user will transit the ticket (click on Start progress transition button) from ToDo to In Progress then automatically the brach should create in Bitbucket, for this, you need to add workflow triggers on start progress transition.

Like sunisgcet likes this
sunisgcet October 15, 2019

Once again Thank you @Yogesh Mude .as per you mentioned above i did.but in bitbucket there is only default master branch showing. if i locally made a commit using my issue key it shows commit history but not showing branch ..how can i verify branch should created .here i attached my snap.  

sunisgcet October 15, 2019

jira-1.PNGjira-2.PNGthese are.

Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2019

HI @sunisgcet 

Sorry, its muy mistake, actually it's not like that you want.

If you added the branch create trigger into start progress workflow transition then whenever a user will create a branch manually in bitbucet then the issue will auto transit from ToDO to In Progress. 

Like sunisgcet likes this
Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2019

Also please have a look at the previous community discussion for the same.

https://community.atlassian.com/t5/Jira-Core-questions/Automatic-Creation-of-branch-From-JIRA/qaq-p/11278

sunisgcet October 15, 2019

HI @Yogesh Mude but i need to create automatic branch creation..how can i do this .i am confused 😕, then why we used branch created trigger on jira workflow.?

sunisgcet October 15, 2019

@Yogesh Mude i read that previous discussion if any examples link or videos  means it will be useful for me.

Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2019
sunisgcet October 17, 2019

Hi @Yogesh Mude Member  i just tried one method. i created one jira project inside that project i created one issue then i add the workflow for my project  in that workflow i added trigger (branch created , commit created) and then i go with my bitbucket existing which i created before , in that repo i do some commit codes from local to remote  while doing this i commit with my jira issue key id .git commit -m "jira issue key initial commit " and then i add to remote using command "git remote add jira issue key my repo url".defaulty there is a master branch available in bitbucket first time we push any codes into bitbucket. then i checked branch using command "git branch -a" , it showed master branch only . then i created a new branch with my jira issue key using command  git checkout -b jira issue key", it created new branch and switched to new branch wat i created with my jira issue key. then i push this branch into remote  using command "git push issue key issue key", then i refreshed my jira and bitbucket and checked it there is new branch created on the jira & bitbucket with the same name of my jira issue key. if i  doesnt commit without my jira issue name on the jira my issue UI  it doesnt show any changes .

i dont know it is right or wrong  but these are i did manually on the bitbucket with my iisue key. i think this is differ from automatic branch creation per issue. because i execute commands manually on the bitbucket. i just sharing this to you what i tried  .

i know it is bit complex to read this comment, Thanks .

Yogesh Mude
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2019

HI @sunisgcet , Its Okay.

Yeah, agreed, unless until you provide the Jira issue key while committing your changes won't reflect that respective Jira issue and its called smart committing, so please follow the best practices.

You can find details information here.

sunisgcet October 17, 2019

Yup @Yogesh Mude Thanks for replied .. i ll look to the smart commits.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events