开发者

How can I create a large message on git merge?

I would like to do a git merge to plough t开发者_开发技巧he work of one branch back into another.

However, since a lot has been done and I'm going to do a no-fast-forward merge I would like the commit to contain extensive information about what's in the merge.

If I were doing a normal commit I could use the -m flag and an editor would be fired up for me to put the details into (edit this is incorrect - see below). However if I use the -m flag during commit it simply tells me that the message requires content:

$ git merge development --no-ff -m
error: switch `m' requires a value

Since I have a fairly large merge message, I would prefer an editor rather than a single line string. How can I get that though?

EDIT

Although the answers have covered my question I realised that using the -m flag during a normal commit does not in fact fire up the editor (although -a does if you're creating a tag). The only way I've to get the editor during a normal commit it to simply type commit with no other flags or options.


Use the --no-commit flag, and then type git commit - you'll be able to edit the message then:

git merge development --no-ff --no-commit
git commit

Alternatively, if you've already done the merge, you can amend the merge commit to change its message with:

git commit --amend


Perform the commit as usual and change the commit message afterwards using git commit --amend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜