Every time I do a merge I need for a merge commit to be generated and I would like it to have more than just the summary of all the commits.
My question is how can I format git-fmt-merge-msg or what determines this automated message (I can do this manually after a commit by amending it and using git-log --pretty=format:'...')
For example I would like to format it as such:
Merge branch 'test' * test: [BZ: #123] fifth commit subject [BZ: #123] fourth commit subject [BZ: #123] third commit subject [BZ: #123] second commit subject [BZ: #123] first commit subject __________________________________________ Merge details: [BZ: #123] fifth commit subject at 2010-06-30 11:29:00 +0100 - fifth commit body [BZ: #123] fourth commit subject at 2010-06-30 11:22:17 +0100 - fourth commit body [BZ: #123] third commit subject at 2010-06-30 11:21:43 +0100 - third commit body [BZ: #123] second commit subject at 2010-06-30 11:21:30 +0100 - second commit body [BZ: #123] first commit subject at 2010-06-30 11:29:57 +0100 - first commit body
To change the most recent commit message, use the git commit --amend command. To change older or multiple commit messages, use git rebase -i HEAD~N . Don't amend pushed commits as it may potentially cause a lot of problems to your colleagues.
To amend the message of your last Git commit, you can simply execute the “git commit” command with the “–amend” option. You can also add the “-m” option and specify the new commit message directly. As an example, let's say that you want to amend the message of your last Git commit.
Looks like as of version Git 1.7.8 you can do git merge --edit ...
to specify the commit message.
And as of 1.7.10, dropping into edit mode will be the default behavior
From this release on, the "git merge" command in an interactive session will start an editor when it automatically resolves the merge for the user to explain the resulting commit, just like the "git commit" command does when it wasn't given a commit message.
(though I'm not seeing it on in msysgit on windows).
I'm aware this isn't answering the original question, but for the benefit of git noobs like myself who reach this page because it's currently the first Google result for "git change merge commit message", I'll mention that it is possible to:
git commit --amend -m"New commit message"
to change the commit message of a merge commit without losing the link to any of the parents of the merge commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With