I know that git diff --word-diff=color
shows a word diff between the working tree and HEAD, but is there a way to get the same kind of output with git log
?
Can you get a word-diff with `git log`?
What about --color-words
? Additionally you somehow have to activate the diff.
git log --color-words -p
shows me kind of a colored diff.
That outputs line diff, not a word diff –
Legionary
On 1.7.1 and with my settings (nothing diff-related, apart from maybe
color.ui=auto
it outputs a word diff.) Of course only when your source contains word differences (= differences smaller than whole added/removed lines). –
Howells OK I think I got it working with
git log -m -p --word-diff=plain
This gives me a error:
fatal: unrecognized argument: --word-diff=plain
. What is your git version (git --version
)? –
Howells git version 1.7.3.2. But on my linux box, which currently has 1.7.0.4, I get the same error. –
Legionary
So looks like they added the support to
--word-diff
to git log
between these versions (which makes sense, since the option was already possible for git diff
). –
Howells Nice. Now if only git would use that for actual patches, indenting a block of code might not result in merge conflicts! –
Irony
© 2022 - 2024 — McMap. All rights reserved.
git diff --color-words rev1..rev2
only gives expected colored output. If I trygit diff --word-diff=color rev1..rev2
it shows the git-diff usage. – Hushhushgit log
in such a way that it just prints the SHA1s, then iterate through those SHA1s and dogit diff --word-diff=color $SHA1^ $SHA1
. Then of course you could assign a git alias to that. – Od