Configure `git pull` to use --ff and `git merge` to use --no-ff

git

Solution

I would suggest setting `merge.ff=false` and using `git pull --rebase` to get new changes.

If you have no local commits, it will give the same result as `git pull`, but without doing a merge.

If you do have some local commits it will rebase those, avoiding the usually unwanted merge commit.

This way you make sure you get a merge commit for all explicit merges, and avoid the noise of implicit merge commits, which is usually exactly what you want.

Problem

I would like `git merge` to default to `--no-ff` and `git pull` to use `--ff` when it merges the fetched branch. Is there a way to configure git to do this automatically?

Original source