Take a loook at --edit
flag for git merge
: https://www.kernel.org/pub/software/scm/git/docs/git-merge.html
--edit
--no-edit
Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can
explain and justify the merge. The --no-edit option can be used to
accept the auto-generated message (this is generally discouraged). The
--edit option is still useful if you are giving a draft message with the -m option from the command line and want to edit it in the editor.
Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message. They will see an
editor opened when they run git merge. To make it easier to adjust
such scripts to the updated behaviour, the environment variable
GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.
update
To simplify you may add alias:
git config --global alias.emerge 'merge --edit'
and then just use git emerge <branch>
instead of git merge --edit <branch>
update 2
Maybe you don't need to 'be able to edit default commits msg' but to create separate commit even for fast-forward merged (this is considered to be a good practice to do a separate commit even for fast-forwards).
The you just need to set merge.ff
option to false
.
Run git config merge.ff false
(for single repo) or git config --global merge.ff false
(globally for all repos).
merge.ff
By default, git does not create an extra merge commit when merging a
commit that is a descendant of the current commit. Instead, the tip of
the current branch is fast-forwarded. When set to false, this variable
tells git to create an extra merge commit in such a case (equivalent
to giving the --no-ff option from the command line). When set to only,
only such fast-forward merges are allowed (equivalent to giving the
--ff-only option from the command line).
(https://www.kernel.org/pub/software/scm/git/docs/git-config.html)
Once this performed each git merge
command will create separate commit and user will be dropped to message editor