dhblah
dhblah

Reputation: 10151

Why git asks to enter merge message?

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?

Upvotes: 3

Views: 662

Answers (4)

John Szakmeister
John Szakmeister

Reputation: 47022

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. :-)

Upvotes: 7

edem
edem

Reputation: 3272

The section "CONFIGURATION" from man git-merge says:

merge.log In addition to branch names, populate the log message with at most the specified number of one-line descriptions from the actual commits that are being merged. Defaults to false, and true is a synonym for 20.

Upvotes: 1

Jayram
Jayram

Reputation: 19578

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

Upvotes: 2

user823738
user823738

Reputation: 17521

A merge is a commit. So you should enter the commit description.

Upvotes: 1

Related Questions