How to reset the number of commits associate with a Jira issue after a rebase.

Ergin Salih
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 30, 2021

When I rebase a branch and push that branch  to bitbucket (using push -f) the number of commits that the Jira shows increments by the total number of commits in the branch.  For example assume you have 50 commits, you rebase the branch, then push the newly rebased branch to bitbucket, the number of commits associated with the Jira now shows 100.

This is an example ...

Screenshot 2021-09-30 134627.png

The 3 branches have a total of around 100 commits.

It seems like the commits that have gone away as a result of the rebase are still in a cache somewhere and are contributing to the total number.

Is there a way of asking Jira to recalculate the number of commits based on the active commits, i.e. those that are actually live in branches?

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2021

Hi Ergin,

I do not believe there is an easy way to reset such commits.  Rebasing re-writes the project history by creating brand new commits for each commit in the original branch, as mentioned in https://www.atlassian.com/git/tutorials/merging-vs-rebasing

Because of the way that Jira references development commits, any commit that contains the Jira issue key either in the title or the message will appear on that Jira issue.  So technically Jira is behaving as expected here.  In order to affect this change, you would have to somehow change the commits to remove that issuekey from them back on the other branches.  I don't know how feasible that would be to do from Bitbucket side of things, but I suspect this is not a trivial change to make.

Andy

André Hänsel
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!
August 15, 2022

In order to affect this change, you would have to somehow change the commits to remove that issuekey from them back on the other branches.

Those commits can't be changed because they don't exist any more in the repository. The only reference to them that remains is in Jira. Jira just would have to remove them from its database. It should already have the information which commits are contained in a branch, it's just a matter of removing those that are no longer in the branch.

Like # people like this
Eric Dyke
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!
May 15, 2024

Has there been any movement on resolving the rebase issue?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events