Changes view: optionally show as unified diff

peradetlic 4 years ago updated by Daniel Schürmann 2 months ago 12 1 duplicate

The simplified or "unified" diff view (the default on GitHub for example) is often the preferred way to look at changes, especially on smaller screens

Duplicates 1

The "diff" view is not the preferred view but just the simplest implementation because it is the result of an invoked command and hence used by plain Git command wrappers.

I think we have a nomenclature misunderstanding (sorry), I meant, the "changes" window in SmartGit.

Basically, the option to switch like this https://github.com/blog/1884-introducing-split-diffs

Under review

I've understood exactly this. Currently, we just fill our compare with the file contents and the view compares them itself. Using a diff output would require to first have the compare result and then fill the view. This would require major refactoring effort - for the benefit of a harder to read result.


Terms like "preferred" an "harder to read" are subjective. Whenever I'm on a notebook (which turns out to be most of the time), I prefer the unified view.

If your argument is that it's too much work, I won't argue with that, but If you think it not worth doing because noone will find it useful, I beg to differ. The most popular source control website defaults to the unified view, and many users might find it easier to read as it is the view they are used to.

IMHO the unified diff view is harder to read but has the advantage of needing less horizontal space.

A unified or "changes only" view would be much nicer than the current full-file split pane diff.

"Nicer" seems odd. More compact, yes, but nicer? For example, syntax highlighting will not be possible in the unified diff.

I don't need or care for syntax highlighting in my version control system GUI. I want to see changes and control and manage them. For everything else I can use my IDE. git-cola seems to manage this quite well.

Nice to have but not worth "major refactoring" there are more pressing matters IMHO.

Version 17.1 comes with an optional compact display: Changes|Compact Change Display


I don't think one view is inherently better than the other. Some people prefer unified, some people prefer side-by-side. If you want a bigger audience for your product, you may want to offer both options. I was looking for the option and ended up here.

One thing that is made slightly easier by unified view, is staging changes line by line. With unified, I can select the last lines of a block of deleted lines and the first lines of an adjacent block of added lines and stage them together.

Line-by-line staging was one of the reasons I used SourceTree and the reason why I use SmartGit after switching from macOS to Linux.

I love smartgit for it's nice side by side diff view. This is especially handy for resolving conflicts and staging commits.

However I like to optional see the unified diff view from gitk or GitHub during reviews.

This has these advantages:

* I can see changes vertical aligned

* I can skim newspaper like through the diff without looking to the left and right column at every change.

* It required less vertical space, no vertical scrolling on small screens.

* Less or no horizontal scrolling for two changes in a big file.

Currently I use gitk on my daily work and open smartgit during merges or whenever the side by side diff is handy.

Since we are now using the Pull Request feature, I like to comment directly in smartgit but using the diff view to have a quick overview to the changes without to much scrolling.