[Git] How to enable --no-ff (no fast-forward) by default

Tadashi Shigeoka ·  Sun, November 25, 2012

I’ll introduce how to configure git to enable —no-ff (no fast-forward) by default.

Git

Method of creating an alias

git config --add alias.nffmerge 'merge --no-ff'

Alternatively, add the following content to .gitconfig.

[alias]
    nffmerge = merge --no-ff

Method of specifying mergeoptions

This is a configuration to always add the —no-ff option when merging to the master branch.

If you want to configure other branches as well, use branch.branch_name.mergeoptions.

git config branch.master.mergeoptions '--no-ff'

Alternatively, add the following content to .gitconfig.

[branch "master"]
    mergeoptions = --no-ff

That’s all from the Gemba.

Reference Information