Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,887
Community Members
 
Community Events
168
Community Groups

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

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 Oct 04, 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

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.

Suggest an answer

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

Atlassian Community Events