tig
tig copied to clipboard
support diffs for merge commits
per http://stackoverflow.com/questions/25967014/how-to-get-proper-diff-of-merge-commit-in-tig
Looks like you found a solution using a keybinding:
bind diff 7 !git diff %(commit)^ %(commit)
Please consider re-opening it.
It would be more convenient to have the diff right there by default (not via some external tool/pager), similar to using git log -p -m
.
I can see that the current behaviour is good, because it shows any changes which might have been done in the merge commit itself (like git log -p -c
), but there could be some key-binding to toggle this (between the patch of the merge commit and the changes brought in by the merge).
@blueyed What would be the expected behaviour for merges with multiple parents?
I'm not sure. Maybe Git's --first-parent
could/should be used with the -m
-mode (by default)?
I can see three modes here:
- the current (new default?), showing any changes in the merge commit (usually empty)
- showing the full diff against the first parent (
-m --first-parent
) - and the full(?) merge diff (
-m
).
I am not sure if I understand --first-parent
correctly though, from git-log(1)
:
git log -p -m --first-parent
Shows the history including change diffs, but only from the “main
branch” perspective, skipping commits that come from merged branches,
and showing full diffs of changes introduced by the merges. This makes
sense only when following a strict policy of merging all topic
branches when staying on a single integration branch.
(Here is an additionally use case: I often use tig
to see what has changed after git fetch
(e.g. via an alias tignews=tig HEAD@{1}..HEAD@{0}
), and if there are merge commits, the commits itself are often not included in the list view's range. Having the diff in the merge then would be helpul.)
I don't see this mentioned here, but this used to work exactly this way (seeing diffs for merges), until it stopped working in 9febe931fb14f71d05d082aef94b17fe45e529f3
OK, I'll make a diff specific filter for rev args
Any update on this? I'd love to have a built-in way to see the entire diff produced by a merge (though not by default).
Anything wrong with tig -m
?
Anything wrong with
tig -m
?
It appears to not be documented at least (--help
and man page), and it cannot be toggled in an open instance, can it?
I assume it works because it passes the option through to git-log
then?
Yes, it's what it does, that's why it's not documented. In an open instance you can define custom bindings with :set diff-options = -m
and :set diff-options =
. It's not perfect, especially if you already use diff-options as you'll have to modify your bindings accordingly, but it does the job.
That does the job then I assume.
On Tue, Feb 04 2020, Daniel Hahler wrote:
That does the job then I would assume.
.. maybe, we can have toggle for it? ;)