Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure git mergeoptions --no-edit on all branches

Tags:

git

merge

I'm trying to configure git to always accept the default merge message when merging (with option --no-edit). I found this answer (Git merge doesn't use default merge message, opens editor with default message) but it doesn't work for me, and it is not listed in the manual (git-config).

The following configuration (with an actual branch name rather than "*") does work for a single branch, but I need the configuration on all branches, so I tried this, to no avail.

[branch "*"]
    mergeoptions = --no-edit

Is there any global configuration to do this ?

EDIT

While searching I found the branch "*" configuration was proposed a while back as a patch, but never implemented ([PATCH] Add default merge options for all branches).

like image 563
Alexandre DuBreuil Avatar asked Jan 30 '14 16:01

Alexandre DuBreuil


People also ask

Does git merge affect both branches?

No, merging does only affect one branch.

How do I merge without committing?

With --no-commit perform the merge and stop just before creating a merge commit, to give the user a chance to inspect and further tweak the merge result before committing. Note that fast-forward updates do not create a merge commit and therefore there is no way to stop those merges with --no-commit.

What is git config pull rebase true?

Setting this to true means that that particular branch will always pull from its upstream via rebasing, unless git pull --no-rebase is used explicitly.

Why you should rebase instead of merge?

But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch. The major benefit of rebasing is that you get a much cleaner project history. First, it eliminates the unnecessary merge commits required by git merge .


1 Answers

Overriding the merge command with an alias that appends --no-edit seems to work:

[alias]
    merge = merge --no-edit
like image 142
bkeepers Avatar answered Sep 27 '22 19:09

bkeepers