Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is git committing on merge, even after "git config –global merge.commit no"?

I’m using git 2.39.2 on macOS 10.15.7

I ran the following:

git config --global merge.commit no
git config --global merge.ff no

So my ~/.gitconfig now looks like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

# This is Git's per-user configuration file.
[user]
    name = myname
    email = myemail@example.com
[http]
    postBuffer = 1048576000
[merge]
    commit = no
    ff = no

But still, when I run the following:

git switch main
git merge feature

It automatically brings me into a commit message editor.

Running git merge --no-commit feature still works as expected and gives me:

Automatic merge went well; stopped before committing as requested

But why doesn’t it do that without --no-commit when I have commit = no in my ~/.gitconfig settings?

>Solution :

But why doesn’t it do that without –no-commit when I have commit = no in my ~/.gitconfig settings?

Because there is no merge.commit config variable. You can set any key you want in your config, but it won’t do anything unless some piece of code recognizes it. There’s no mention of merge.commit anywhere in the git source or documentation.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading