5

How can I set the option ignore-space-change for all merges using git config?

I could perhaps use an alias on merge, but since I want that setting to apply to git stash pop, git stash apply, git pull and git merge, and others if any, I'd like a cleaner way than setting up many aliases (I don't even know if I could set up an alias stash for the subcommands).

I looked in the docs, but couldn't find the configuration option to use.

Suzanne Soy
  • 3,027
  • 6
  • 38
  • 56
  • possible duplicate of [How to make git diff --ignore-space-change the default](http://stackoverflow.com/questions/7310033/how-to-make-git-diff-ignore-space-change-the-default) – Thomas Ruiz May 26 '14 at 10:44
  • 1
    @ThomasRuiz it's definitely related, but that question is only about `git diff`, not `git merge` (Maybe `git merge` relies on `git diff` internally?) – Suzanne Soy May 26 '14 at 10:46

1 Answers1

2

Per-branch:

git config branch.$branchname.mergeoptions "-X ignore-space-change"

found by scanning the git config docs for "merge". If there's a global option setter I don't see it, a git alias would probably do it:

git config alias.i-s-c-merge "merge -X ignore-space-change"

and I think every shell has tab completion on git commands these days so it's git i- and tabkey instead of spacebar.

jthill
  • 55,082
  • 5
  • 77
  • 137
  • 1
    Which branch does that affect? If I set mergeoptions on `master`, and want to merge `new_feature` into it, do I need the setting on `master`, on `new_feature`, or on both? – rjmunro Nov 30 '16 at 09:29