How to configure "git pull --ff-only" and "git merge --no-ff"

23,082

That shouldn't be the case, according to the git-config man page on pull.ff:

(...) When set to only, only such fast-forward merges are allowed (equivalent to giving the --ff-only option from the command line). This setting overrides merge.ff when pulling.

The configuration pull.ff has been introduced in Git 2.x, so it won't work as expected on Git 1.x -- it will probably pick up the merge.ff configuration and use that when doing a Pull.

Share:
23,082

Related videos on Youtube

Robert Huffman
Author by

Robert Huffman

Updated on February 10, 2020

Comments

  • Robert Huffman
    Robert Huffman about 4 years

    A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option.

    I also make local branches for feature work. I want to preserve the branch history, so when I merge the local branch back to my local clone, I use the --no-ff option.

    How can I configure git to use those options by default? Currently my .gitconfig looks like this:

    [merge]
      ff = false
    [pull]
      ff = only
    

    However, git pull (which is really git fetch and git merge) seems to be picking up the merge option and therefore creating merge.

  • Robert Huffman
    Robert Huffman about 8 years
    Ha! I knew this worked for me at one point. I recently reinstalled Linux Mint and completely forgot to check the version of git. The 'official' repository is still on 1.9!
  • sashoalm
    sashoalm about 7 years
    For some reason pull.ff is not listed in tab completion but it works all the same.
  • Franklin Yu
    Franklin Yu over 4 years
    Does this .ff option has a per-branch version? Something similar to branch.<name>.mergeOptions?