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

Rumpa Giri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 22, 2017

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

 

4 answers

1 vote
Adam Wride
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.
September 26, 2017

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

Yevgenii Sleptsov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 14, 2024

6 years later and you still do not have this feature.

When do you planning to implement it?

0 votes
Mark L. Smith
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.
September 3, 2018

You can edit Git commit <-> Jira issue association in version 2.16.5 which is now released.

Mark Y May 1, 2024

Huh?  2.16.5??  Is that the version of Jira??  Surely not, that version is ancient.

0 votes
Rumpa Giri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2017

 

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

Thanks again,

Rumpa

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events