Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-8384

Allow editing of the full commit message when merging a pull request

    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Currently when you merge a pull request through the Stash web front-end, you do not have full control of the commit message. This leads to polluted commit logs on master.

      In particular, my group would like to use the squash merge strategy and have clean commit messages once the pull request is accepted. The only way to work around this issue that I am aware of is outlined here:
      https://answers.atlassian.com/questions/283338/pull-requests-squashed-commits-remote-merges?continue=https%3A%2F%2Fanswers.atlassian.com%2Fquestions%2F283338%2Fpull-requests-squashed-commits-remote-merges&application=acac

      This behavior means that what should be a 1 click operation is turned into a more laborious and error prone process.

            [BSERV-8384] Allow editing of the full commit message when merging a pull request

            Thanks Bryan. I understand the complexities too, now. We'll continue to use --amend for now, I think. Or perhaps set summaries to 0 and then generate the commit log on the CLI and paste it in. Something like that.

            KevinLentin added a comment - Thanks Bryan. I understand the complexities too, now. We'll continue to use --amend for now, I think. Or perhaps set summaries to 0 and then generate the commit log on the CLI and paste it in. Something like that.

            Understood, thanks for the explanation, Bryan.  I'll set the commit summaries to 0 as suggested, and go from there.

            Robert Brown (-rb) added a comment - Understood, thanks for the explanation, Bryan.  I'll set the commit summaries to 0 as suggested, and go from there.

            ae94fa5302fb, kevin.lentin1115569628,

            Unfortunately, it's not an "easy thing to do". The summaries are appended by git merge --log. We don't generate them. All we do is include the flag (or omit it, if the Commit Summaries count is set to 0), and git merge handles the rest on its own. It's not functionality "Atlassian implemented"; it's standard Git functionality we use, and nothing more.

            There are ways we could generate the same message manually, but the complexity ranges. Squashing, for example, uses a totally different format. There's a top-level git command we can use for the git merge --log output (git fmt-merge-msg), but there's no command to generate similar output to what SQUASH_MSG includes for --squash merges, at least that I'm aware of. We'd need to assemble that ourselves. Not impossible, by any stretch, but not an "easy" change either. Regardless of how we'd go about actually getting the message, since the merge strategy to use is merge-time-selectable there's another layer of complexity in showing the "right one". Not to mention handling all the user interactions, like the case where the dialog opens with a non-squash strategy selected by default (so we'd show the fmt-merge-msg output), the user modifies the message and then changes the strategy to a squash-based strategy. Clearly they won't want us to clobber their modifications, but what should we do with the SQUASH_MSG details at that point? Getting the user interactions "right" is likely to be more complex than any technical hurdle.

            BSERV-10559 tracks additional improvements related to pull request merge messages. If/when any further improvements are made, they'll be discussed there. For now, the system already allows editing the full merge message: Set commit summaries to 0 and edit the message; whatever you type in will be what's used, verbatim, on the resulting commit. (If you want your own version of the SQUASH_MSG, here's the relevant Git code.)

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - ae94fa5302fb , kevin.lentin1115569628 , Unfortunately, it's not an "easy thing to do". The summaries are appended by git merge --log . We don't generate them. All we do is include the flag (or omit it, if the Commit Summaries count is set to 0), and git merge handles the rest on its own. It's not functionality "Atlassian implemented"; it's standard Git functionality we use, and nothing more. There are ways we could generate the same message manually, but the complexity ranges. Squashing, for example, uses a totally different format. There's a top-level git command we can use for the git merge --log output ( git fmt-merge-msg ), but there's no command to generate similar output to what SQUASH_MSG includes for --squash merges, at least that I'm aware of. We'd need to assemble that ourselves. Not impossible, by any stretch, but not an "easy" change either. Regardless of how we'd go about actually getting the message, since the merge strategy to use is merge-time-selectable there's another layer of complexity in showing the "right one". Not to mention handling all the user interactions, like the case where the dialog opens with a non-squash strategy selected by default (so we'd show the fmt-merge-msg output), the user modifies the message and then changes the strategy to a squash-based strategy. Clearly they won't want us to clobber their modifications, but what should we do with the SQUASH_MSG details at that point? Getting the user interactions "right" is likely to be more complex than any technical hurdle. BSERV-10559 tracks additional improvements related to pull request merge messages. If/when any further improvements are made, they'll be discussed there. For now, the system already allows editing the full merge message: Set commit summaries to 0 and edit the message; whatever you type in will be what's used, verbatim, on the resulting commit. (If you want your own version of the SQUASH_MSG , here's the relevant Git code .) Best regards, Bryan Turner Atlassian Bitbucket

            Yes, KevinLentin's final paragraph, and my final paragraph, are saying the same thing. Please put the commit summaries into the merge dialog box as part of the suggested/default commit message, so that they can be human-modified.

            Robert Brown (-rb) added a comment - Yes, KevinLentin's final paragraph, and my final paragraph, are saying the same thing. Please put the commit summaries into the merge dialog box as part of the suggested/default commit message, so that they can be human-modified.

            KevinLentin added a comment - - edited

            @Bryan Turner - I think you've misunderstood the request. Your response seems to indicate you think I'm asking for automation of some kind. No. I just want to be able to edit the message. That's it. Bitbucket creates a squash commit message containing every date/author/commit-id/comment of every commit in the merge. That's cool. Just pop it into an edit box and let me adjust it before commit. I just want to trim things down a bit, remove useless commit messages (fixed typo, "merged master into feature", etc) so the commit message simply contains the work that's in it. As a completely manual task. The process is subjective anyway.

            My current flow is this:

            • PR
            • Merge using squash in Bitbucket UI
            • git checkout master
            • git pull --prune
            • git commit --amend
            • Go through and clean up the commit message, reduce it from 100 lines to 10
            • git push --force

            And just hope you get it done quickly enough that nobody else pushes before your --force. That's just silly.

            All we need is to be able to edit the message before the commit gets made. Maybe add a "edit commit message before merge" checkbox to the merge screen.

            Or, perhaps stated differently: Add the commit summaries to the message BEFORE you present it on the PR merge screen shown in the attachment. Currently we can edit the heading before bb adds the commit summaries. I want to edit the commit summaries.

            KevinLentin added a comment - - edited @Bryan Turner - I think you've misunderstood the request. Your response seems to indicate you think I'm asking for automation of some kind. No. I just want to be able to edit the message. That's it. Bitbucket creates a squash commit message containing every date/author/commit-id/comment of every commit in the merge. That's cool. Just pop it into an edit box and let me adjust it before commit. I just want to trim things down a bit, remove useless commit messages (fixed typo, "merged master into feature", etc) so the commit message simply contains the work that's in it. As a completely manual task. The process is subjective anyway. My current flow is this: PR Merge using squash in Bitbucket UI git checkout master git pull --prune git commit --amend Go through and clean up the commit message, reduce it from 100 lines to 10 git push --force And just hope you get it done quickly enough that nobody else pushes before your --force. That's just silly. All we need is to be able to edit the message before the commit gets made. Maybe add a "edit commit message before merge" checkbox to the merge screen. Or, perhaps stated differently: Add the commit summaries to the message BEFORE you present it on the PR merge screen shown in the attachment. Currently we can edit the heading before bb adds the commit summaries. I want to edit the commit summaries.

            Robert Brown (-rb) added a comment - - edited

            I came looking for a way to edit the default message that bitbucket inserts when we merge a PR with the "squash, ff-only" strategy. I don't like the message they insert in there which says "merge pull request #xxx branch this to branch that", followed by a bunch of newlines and older commit messages. it's ugly.

            I came across this ticket, and I felt like you were requesting the same thing I was looking for: I want to type a new commit message which summarizes, in my own words, what this whole squashed clump of commits is doing.

            The conversation between you and Atlassian left me with the impression you didn't understand each other.

            I then discovered, in continued googling, that the default message that bitbucket inserts IS EDITABLE. I just have to click on the words next to my face, and type a new message in. The OP's screenshot kind of shows that–he has clicked in the field since I see the text insertion point, but he hasn't erased his default message (yet).

            The whole mess of newlines and commit messages from the many-commits-before-the-squash aren't visible here, but they do get added to the commit log, UNLESS YOU TURN THAT OFF. By turning off that part, you will have full control over your commit message--just the words you type manually in this dialog, prior to hitting Merge.

            You can TURN OFF those many-commits-before-the-squash messages in your project settings, on the MergeStrategies page, in the "Commit Summaries" section at the bottom--just set it to 0. At that point, you'll have just your freshly-typed, new squash commit summary message, and none of the 10 pages of prior commit IDS, committers and dates.

            That's good enough for me.  But oh, I do see that you're wanting to visually see and maybe modify those prior commits. That would be easy for Atlassian to do:  Just take the "20" (or however many 'Commit Summaries' are configured) commit comments, and throw them into that text field at the top, so we can hand edit THE ENTIRE THING. The issue with the way Atlassian implemented it, is they append the "20" commit summaries to whatever you type in the dialog box. It would be better if they just included those summaries IN the text field in the box.

            Robert Brown (-rb) added a comment - - edited I came looking for a way to edit the default message that bitbucket inserts when we merge a PR with the "squash, ff-only" strategy. I don't like the message they insert in there which says "merge pull request #xxx branch this to branch that", followed by a bunch of newlines and older commit messages. it's ugly. I came across this ticket, and I felt like you were requesting the same thing I was looking for: I want to type a new commit message which summarizes, in my own words, what this whole squashed clump of commits is doing. The conversation between you and Atlassian left me with the impression you didn't understand each other. I then discovered, in continued googling, that the default message that bitbucket inserts IS EDITABLE. I just have to click on the words next to my face, and type a new message in. The OP's screenshot kind of shows that–he has clicked in the field since I see the text insertion point, but he hasn't erased his default message (yet). The whole mess of newlines and commit messages from the many-commits-before-the-squash aren't visible here, but they do get added to the commit log, UNLESS YOU TURN THAT OFF. By turning off that part, you will have full control over your commit message--just the words you type manually in this dialog, prior to hitting Merge. You can TURN OFF those many-commits-before-the-squash messages in your project settings, on the MergeStrategies page, in the "Commit Summaries" section at the bottom--just set it to 0. At that point, you'll have just your freshly-typed, new squash commit summary message, and none of the 10 pages of prior commit IDS, committers and dates. That's good enough for me.  But oh, I do see that you're wanting to visually see and maybe modify those prior commits. That would be easy for Atlassian to do:  Just take the "20" (or however many 'Commit Summaries' are configured) commit comments, and throw them into that text field at the top, so we can hand edit THE ENTIRE THING. The issue with the way Atlassian implemented it, is they append the "20" commit summaries to whatever you type in the dialog box. It would be better if they just included those summaries IN the text field in the box.

            kevin.lentin1115569628,

            In the spirit of openness and to try and set realistic expectations, I suspect there's not much chance the system ever offers that sort of functionality.

            • Merging without showing a dialog isn't something the system should offer; the merger should always get a chance to review those details to ensure they're targeting the correct branch, see any auto-merge they might trigger, confirm whether they want the merged branch deleted, etc., before the merge runs. The dialog gives the user a chance to back out and change their mind.
            • The sort of changes to the squash message you're describing might be scriptable (the more incidentals you throw in, like "perhaps remove the occasional 'updated node_modules'" and "maybe I might keep one author", the less likely it is the work could be done in an automated way without "mistakes"), but are not sufficiently generic for it to be something the system includes.
            • "Or maybe I might keep one author. Because if I'm merging, I want the code author credited." BSERV-4415 seems like a better solution for this than an "Author:" line in the commit message, and is more likely to be what we implement.

            BSERV-10559 is about making some sort of configurable pattern to allow administrators to configure the things they want to include in the merge message and control, at least at a basic level, how they should be structured, but it's unlikely, as part of building that, that we'll include the sort of text transforms you're describing here.

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - kevin.lentin1115569628 , In the spirit of openness and to try and set realistic expectations, I suspect there's not much chance the system ever offers that sort of functionality. Merging without showing a dialog isn't something the system should offer; the merger should always get a chance to review those details to ensure they're targeting the correct branch, see any auto-merge they might trigger, confirm whether they want the merged branch deleted, etc., before the merge runs. The dialog gives the user a chance to back out and change their mind. The sort of changes to the squash message you're describing might be scriptable (the more incidentals you throw in, like "perhaps remove the occasional 'updated node_modules'" and "maybe I might keep one author", the less likely it is the work could be done in an automated way without "mistakes"), but are not sufficiently generic for it to be something the system includes. "Or maybe I might keep one author. Because if I'm merging, I want the code author credited." BSERV-4415 seems like a better solution for this than an "Author:" line in the commit message, and is more likely to be what we implement. BSERV-10559 is about making some sort of configurable pattern to allow administrators to configure the things they want to include in the merge message and control, at least at a basic level, how they should be structured, but it's unlikely, as part of building that, that we'll include the sort of text transforms you're describing here. Best regards, Bryan Turner Atlassian Bitbucket

            What I want is the ability to edit the squash commit message. We do a PR merge, there is no dialog. It just merges. And we get a commit message with lists of commit IDs, and commiters and dates, etc. It's pages long. What I want to include is the individual comments on the commits. Roll it up, perhaps remove the occasional "updated node_modules". Sure, we could set summaries to zero but then I don't know what they are. I effectively want to take the full squash commentary and delete any blank line, any line starting with commit, Author: or Date:. Or maybe I might keep one author. Because if I'm merging, I want the code author credited. 

            KevinLentin added a comment - What I want is the ability to edit the squash commit message. We do a PR merge, there is no dialog. It just merges. And we get a commit message with lists of commit IDs, and commiters and dates, etc. It's pages long. What I want to include is the individual comments on the commits. Roll it up, perhaps remove the occasional "updated node_modules". Sure, we could set summaries to zero but then I don't know what they are. I effectively want to take the full squash commentary and delete any blank line, any line starting with commit, Author: or Date:. Or maybe I might keep one author. Because if I'm merging, I want the code author credited. 

            nclark1,

            I'm not sure what you're looking for. If the --log messages are a problem for your team, the functionality has been available for ~8 months now to turn them off. With that done, whatever message you put in the dialog is verbatim what is applied to a squash "merge". So the ability to edit the "full commit message" has been available since Bitbucket Server 6.7 was released in September 2019. None of the "Bitbucket competitors" that I'm aware of use --log, so simply setting commit summaries to zero achieves the same end behavior as they have, as far as I'm aware.

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - nclark1 , I'm not sure what you're looking for. If the --log messages are a problem for your team, the functionality has been available for ~8 months now to turn them off. With that done, whatever message you put in the dialog is verbatim what is applied to a squash "merge". So the ability to edit the "full commit message" has been available since Bitbucket Server 6.7 was released in September 2019. None of the "Bitbucket competitors" that I'm aware of use --log , so simply setting commit summaries to zero achieves the same end behavior as they have, as far as I'm aware. Best regards, Bryan Turner Atlassian Bitbucket

            Nick Clark added a comment - - edited

            What's really great about this is that it effectively makes Bitbucket's squash-merging useless if you care about what goes into the squash commit message.

            I'm legit surprised that the dev crew isn't more interested in implementing this feature, which has been asked for by so many people  - across a whole pile of duplicate support tickets. This issue has over a hundred votes and 200 watchers on this ticket alone.

            It should be a basic UI affordance for anybody who's trying to squash-merge, and it's one provided by every Bitbucket competitor that I know about.

            Nick Clark added a comment - - edited What's really great about this is that it effectively makes Bitbucket's squash-merging useless if you care about what goes into the squash commit message. I'm legit surprised that the dev crew isn't more interested in implementing this feature, which has been asked for by so many people  - across a whole pile of duplicate support tickets. This issue has over a hundred votes and 200 watchers on this ticket alone. It should be a basic UI affordance for anybody who's trying to squash-merge, and it's one provided by every Bitbucket competitor that I know about.

              bturner Bryan Turner (Inactive)
              4c762d6af390 Corey Steele
              Votes:
              232 Vote for this issue
              Watchers:
              121 Start watching this issue

                Created:
                Updated:
                Resolved: