Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why git asks to enter merge message?

Tags:

git

When I'm doing git merge, it opens editor where predefined message "Branch merged to " is printed, all I have to do is to save file and quit. Previously it didn't ask me to enter anything and didn't open files. Where it can be configured?

like image 273
dhblah Avatar asked Jan 26 '26 01:01

dhblah


2 Answers

The answer is because the Git and Linux kernel communities thought that the default behavior (not having to enter a message for merges) was lame since people failed to provide a summary of the work being merged. So Linus pointed out that he thought not having an editor fire up for merge messages was a design mistake. The maintainer agreed and changed the behavior. Linus has a Google Plus post about it here, and a discussion on the Git mailing list is here. Junio, Git's maintainer, talks about it here too.

As others have pointed out, you can pass --no-edit on the command line. A lesser known fact is that you can set GIT_MERGE_AUTOEDIT=no and prevent git merge from popping open the editor as well. It's meant to be used for non-interactive scripts, but could be abused as well. :-)

like image 138
John Szakmeister Avatar answered Jan 27 '26 16:01

John Szakmeister


you can use --no-edit too in the flag to prevent being asked for merge message.

like image 45
Jayram Avatar answered Jan 27 '26 17:01

Jayram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!