Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to edit the commit message after a push to repo

Peter_Steven_Price April 22, 2020

Commit messages in our organisation are supposed to include the Jira Ref. But some dont. This means that the links we have between Jira stories and Bitbucket commits arent made. Is it possible to amend these after they have been committed and pushed to the repository event to get the links in place?

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 22, 2020

Generally speaking, it's discouraged to alter Git commits that are already published (pushed to a repo from which your team mates may have pulled those in the meanwhile).

The correct workflow is to require the issue key before the commit is created!

That means that if you try commit without entering a valid Jira issue key in the commit message, your commit should be rejected.

This supports this workflow: https://marketplace.atlassian.com/apps/1214430/better-commit-policy-for-bitbucket?hosting=server&tab=overview  

Peter_Steven_Price April 22, 2020

Yep That is the correct course of action (Require a correct format on commit messges) and wouldn't it be wonderful if that was in place in our organisation? 

Sadly it isnt and so We are where we are; with a shed load of commits that dont link back to the Jira Stories.

Reprimanding the Developers - telling them that they are very naughty doesnt fix the issue.

Sorry this doesnt fix the problem.

We need to change what has already happened.

Like # people like this
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 22, 2020

Some more ideas:

  1. Use Git notes (which AFAIK can be safely altered after creation) instead of the commit message to establish the link. 
  2. Use the Git Integration app. It allows manually linking commits to Jira issues. (The link doesn't become part of the commit message.)
Peter_Steven_Price April 24, 2020

Thank you for your assistance so far. If I use option 1 above, will the Commit then automatically show up in this (Visible on the Jira Story) :
Example Jira Commit fragment.jpg

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 24, 2020

I am not sure. You should try. 

Peter_Steven_Price April 27, 2020

I have and it didnt :( so the Links remain broken - Thanks anyway. There appears no way to fix this.

Peter_Steven_Price May 20, 2020

(Other than by using a Re-Base)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events