Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing git merge from confirming commit message

Tags:

git

I am working on a script in which I am gradually merging the Linux kernel into a branch that took off from an older version and has slightly modified it.

As a result, I have many git merge <sha> -m "merge without conflict" commands in my script. If there is a conflict, the script would stop for the user to resolve and commit with the merge with a proper message.

However, git merge -m "message" ... still brings up the editor, forcing me to confirm the message. How can I prevent this?

I know generally it's not a good idea to have a non-descriptive merge message, but this is one that generated no conflict and it is probably going to happen hundreds of times, so asking the user (myself) for confirmation each time is out of the question.

Edit: This is not always the case. However, this can reproduce the problem:

# Clone Linux's repository

$ git checkout v2.6.38
$ git checkout -b test

$ touch new_file
$ git add new_file
$ git commit

$ git merge v2.6.39 -m "merge message"
# brings up the editor, even though there are no conflicts
like image 598
Shahbaz Avatar asked Dec 16 '12 01:12

Shahbaz


1 Answers

Perhaps the --no-edit flag? The documentation for it says "The --no-edit option can be used to accept the auto-generated message (this is generally discouraged) when merging an annotated tag..."

like image 130
Joshua D. Boyd Avatar answered Oct 28 '22 15:10

Joshua D. Boyd