Repeat rebase step ignoring whitespace

Suppose I'm rebasing some feature branch in git. At some step, I see large conflicts, but I find that most of those conflicts are due to changes in whitespace. Can I somehow get git to repeat just the current merge step, but apply the ignore-whitespace strategy to it, without enabling the ignore-whitespace strategy in all the changes? I'd probably want to re-indent the code after looking at it, so some technique which doesn't automatically continue the rebase but just changes the working tree would be highly desirable.


When a commit application fails, the rebase process is paused and you're supposed to resolve conflicts. At this point just reset the working tree to the last applied commit state (clear the working tree) and then cherry-pick the commit in question with the appropriate strategy: git cherry-pick --no-commit -X ignore-all-space <commit-id>. Then resolve all remaining conflicts and add the resulting state into the index. And voila, now you can continue the rebase with git rebase --continue.

Also you can try tools like kdiff3 which are good in automatic solving of trivial conflict cases.


You can use the -Xignore-space-change option when doing a rebase.

The other answer suggests clearing the index/staging area whenever rebase encounters a conflict, and then cherry picking the commit using -Xignore-space-change. You don't have to do that. You can just do git rebase -Xignore-space-change <target branch>.