Search code examples
gitmerge-conflict-resolutioncommit-message

How to use Git's default commit message when resolving merge conflicts?


After doing a merge and resolving conflicts, is there an "easy" way to just accept the default generated commit message from the command line?

One of our developers will resolve all the conflicts, and then do a git commit -m"Merge Commit" which replaces the generated commit message that listed all the conflict files. I would like to have a different flag that would just take the current file without modification. I know there is a -F or --file= option, but that requires knowing the file name all the time.


Solution

  • Obviously the "right" answer here is to get your developer to follow correct practice for your team when generating merge commits. Note that the behavior you want used to be the default, and that only recently has git begun demanding "human generated" commit messages for merges. That was for a reason, and it wasn't so that developers would short-circuit the process with a meaningless message.

    Maybe the developer is generating merge commits when s/he should be rebasing instead?

    That said, the merge commit is the output of git fmt-merge-msg, to which you would have to feed the parents of the merge commit.