Search code examples
gittortoisegit

How can I set merge "No Fast Forward" as the default in TortoiseGit?


I don't use fast-forward merges in my workflow. I note that in git itself, one can include this in their .gitconfig to get fast forwarding off by default:

[merge]
    ff = false

TortoiseGit doesn't seem to do anything with this, though. When I go to merge, the "No Fast Forward" checkbox is still unticked. When I carry out the merge, I see it still invokes the command git.exe merge Branch_test, without the --no-ff switch.

How do I get it to default off?


Solution

  • Aha!

    Setting

    [merge]
        ff = false 
    

    in the config file does prevent fast forwarding when merging using TortoiseGit, because that changes the behaviour of git.exe itself.

    With that option added, the "No Fast Forward" checkbox on the merge dialogue will not do anything! Instead, all merges will be "no fast forward" merges.

    It's a bit clumsy, because it means I don't have the option in the TortoiseGit dialogue to override that default (ie, to use the --ff switch on the merge command). Still, it does approximately what I need.