3

I've set merge.ff to only in my local Git config:

$ git config --list | grep merge
merge.ff=only

This successfully prevents Git from performing a non-fast-forward merge, as expected.

However, when I want to explicitly allow such a merge and try to override that setting from the command line (either directly or as per this answer), I can't:

$ git merge --no-ff other-branch
fatal: You cannot combine --no-ff with --ff-only.
$ git -c merge.ff=false merge other-branch
fatal: You cannot combine --no-ff with --ff-only.
$ git -c merge.ff=true merge other-branch
fatal: Not possible to fast-forward, aborting.

What am I missing?

Community
  • 1
  • 1
Paul Whittaker
  • 3,817
  • 3
  • 25
  • 20

1 Answers1

4

I probably found the solution of that problem. According to the release-notes of git 1.8.4 the cli was not working correctly:

* The configuration variable "merge.ff" was cleary a tri-state to
  choose one from "favor fast-forward when possible", "always create
  a merge even when the history could fast-forward" and "do not
  create any merge, only update when the history fast-forwards", but
  the command line parser did not implement the usual convention of
  "last one wins, and command line overrides the configuration"
  correctly.
Florian Neumann
  • 5,587
  • 1
  • 39
  • 48
  • 1
    Good find. On the back of this, dug into Git sources and can confirm that this commit[1] merges two ff-related variables into a single "always/never/optionally fast-forward" setting, and first appeared in 1.8.4. Later, this commit[2] fixed the test description, which now clearly refers to exactly the issue I was having. Accepted! [1] https://github.com/git/git/commit/a54841e96b78203598dea6b31b9618f40f107e7b [2] https://github.com/git/git/commit/6d2d43dc9d98ffc385066fbb46c587b6426bf0ac – Paul Whittaker May 08 '14 at 17:02