2

Sometimes when I attempt to do a git pull from a branch, github will create the message:

"please enter a commit message to explain why this merge is necessary, 
especially if it merges an updated upstream into a topic branch."

It will then require me to enter special commands like :wq to complete the merge. However, other times the merge will simply go through without issue or with it asking me to resolve conflicts.

I know this thread discusses how to exit the issue:

Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch

But my question is why does this happen in git to begin with?

Dog
  • 2,726
  • 7
  • 29
  • 66
  • 1
    You might want to elaborate more on the case where the merge completes with no issue, or the case where there are merge conflicts. In the former case, I might guess that is happening when the merge is just a fast-forward. – Tim Biegeleisen Sep 21 '18 at 04:12

1 Answers1

2

This comes from builtin/merge.c#merge_editor_comment(), used in builtin/merge.c#prepare_to_commit(), in order to remind the user what he/she is supposed to use the editor for.
It is called even with builtin/merge.c#merge_trivial().

All the details for that message are in "Git error while updating a repository".

Note: :wq is only because your core.editor configuration must be set to vi/vim by default.
You can use other editors.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250