Search code examples
gitgit-merge

How to run git rebase and ignore whitespace?


I have branch where I have one commit that only modifies whitespace (trailing whitespace and leading whitespace).

I ran git rebase master and git rebase --ignore-whitespace master and in both cases I have a merge conflict with the commit that only changed whitespace.


Solution

  • I can't guarantee that this will help, but you could try
    git rebase -Xignore-space-change master
    or
    git rebase -Xignore-all-space master.
    -X passes options into the merge algorithm, and the default merge algorithm has these options to affect how it handles whitespace.