I have a file, I make some changes. Here how SmartGit shows differences.


As you can see it shows where the difference is within the line. It changes background to red color in concrete position. And it's very good. I don't need to spend time to find differences. I immediately see where is the difference.

Now what it looks like in Magit:

enter image description here

As you can see Magit says that the difference was in WHOLE line. It's not showing where the difference is within the line. So I need to find where is the difference manually. I need to do this every time. It's not very comparable. Suppose I have differences in 20 lines. I need to spend a lot of time to find what actually changed. It's not very good.

Can magit show differences at the actual column where the change is? As in SmartGit.

5 Answers 5


If you want to store that in your config, like me, just add

(setq magit-diff-refine-hunk (quote all))

to your .emacs.d/init.el

This was inspired by phils' answer.


M-x customize-option RET magit-diff-refine-hunk RET

See also the magit-diff-toggle-refine-hunk command, bound to Dt, which you can use to set the behaviour in the current buffer. Use DC-ut to switch on refinement for all hunks in the buffer; otherwise only the refinements for the currently-selected hunk are displayed at any given time (updating as you move between hunks).

To configure the appearance of the 'refined' regions of the diff, use M-x customize-face for the diff-refine-added, diff-refine-changed, and diff-refine-removed faces.


For word diffs to work magit needs to be able to use the diff executable.

So make sure that M-x ielm RET (executable-find "diff") RET returns not nil. If it returns nil add the path to the folder containing your diff executable to the exec-path variable with M-x ielm RET (add-to-list 'exec-path "c:/Program Files/Git/usr/bin") RET

Next you need to make sure that magit is actually using that diff executable. For that enter a magit status buffer, hit D and make sure that -x Disallow external diff drivers (--no-ext-diff) is disabled. Otherwise disable it with -x, set it as default with s and then save the defaults with Dw.

After this is done you can use Dt to toggle the magit-diff-refine-hunk option for your current buffer or follow this answer by phils to make this setting more permanent.


Try ediff-toggle-ignore-case or compare-ignore-case variable. My guess is your diff engine is ignoring case. Might also be in diff options (I'm not sure what are the settings).


Very similar to @loki's answer: Use customize-variable with magit-diff-refine-hunk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.