Windows 10, Emacs 25.1, Magit

I change my simple.xml

I create 2 indents of text (by space key) and add 3 new lines.

Here it's look like in SmartGit:


It's look very nice. I immediately understand where is simple indent and where was add new text.

Now same different on Magit.


As you can see no different between simple indent and new text.

The quesion is: Is it possible to show different the indent and new text? Like on SmartGit.



1 Answer 1


These are two vastly different ways of visualizing changes. In one case you are looking at two versions of the same file and the differences are emphasized using the background color. In the other case you see only the parts of the file that have changes and the removed and added lines are displayed next to each other. Again the differences are emphasized using the background color, but you could also tell which lines were added and removed based on the first character of each line.

Both of these views have advantages and disadvantages. Magit only offers the second view by itself, but it does integrate with Ediff to also offer the first view. You can enter the Ediff view by pressing e on any change.

But that view is heavier. Instead of parts of a file you get to see the file twice in two different buffers. That makes navigation much slower and it is more likely that not all relevant information can be shown at once, which makes it harder to grasp what changes. On the other hand it becomes easier to view parts of a change in context, which can also be very helpful.

Still, I would recommend using plain diffs at least in simple cases.

Note that contrary to what you said, all information about changes that is visible in the first screenshot is also visible in the second. You can tell whether something is a modification or an addition by looking for red lines next to green lines. But lets improve the displayed information a bit anyway.

(setq magit-diff-refine-hunk t)

Now the added spaces are highlighted using a different shade of green to indicate that that is the part of the line that actually changed. Likewise if you remove text from lines, then those parts are shown in a different shade of green.

enter image description here

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.