I would like to do a git merge
to plough the 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.
Press “esc” (escape) Write “:wq” (write & quit)
The most commonly used strategies are Fast Forward Merge and Recursive Merge. In this most commonly used merge strategy, history is just one straight line. When you create a branch, make some commits in that branch, the time you're ready to merge, there is no new merge on the master.
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
.
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