How to link old commits which did not have ticket numbers in commit message to JIRA ticket?

Hello,

 

We just started using this plugin Git Integration for Jira.

And hence quite a few files were committed without the commit message format of having the JIRA ticket number in commit message.

  1. How can we go back to those old files and link them to appropriate JIRA tickets so that the "Git Commit" tab displays the correct file/commit associations?
  2. If we make a mistake in the initial commit of adding the old JIRA ticket, how do we correct the commit association to the right JIRA ticket?
    1. Note : Subsequent commit messages had the correct JIRA ticket number so the it does appear but initial commit is tied to another JIRA ticket which is kind a confusing..

Can some one please provide some pointers?

Thanks a lot,

Rumpa

 

3 answers

Hello Rumpa - 

Just following up on our conversation we had via email about evaluating the Git Integration for JIra Cloud add-on.

In the Jira Cloud product we offer the ability to modify the association of the commit with a Jira issue. You can see a video on how to do this here: https://bigbrassband.wistia.com/medias/kmvlr97c3x

On our Jira Server product - we don't (yet) have this feature - but we do index git notes which allows you to add a note to a commit after the fact which could include a new Jira issue key. 

Let me know if you have any additional questions.

- Adam 

support@bigbrassband.com

0 vote
Mikael Sandberg Community Champion Sep 22, 2017

In order to change old git commits you would have to use rebase to get back to the commit you want to change:

git rebase --interactive '<sha-1 commit number>^'

That will start the interactive rebase and it will allow you to edit your commit comment. Once you are done editing, commit your changes:

git commit --all --amend --no-edit

Then continue your rebase:

git rebase --continue

To get back to the HEAD.

Just be careful when you push, the rebase will change the SHA-1 of that commit and it's children, so it rewrites the history in the repository from that point on. Do not use git push --force, that can break your repository.

 

Thank you Adam for your detailed reply earlier. Your steps helped me relocate and associate the older files manually.

Thanks again,

Rumpa

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 10, 2018 in Marketplace Apps

Learn about how Stefan K. built one of the *first ever* Marketplace apps

In this post you will discover more about the evolution of K15t software, some big topics they're currently focusing on in the app space, and a rare (not not funny!) photo of founders Mike Cannon-Bro...

12,826 views 11 24
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you