Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you get a word-diff with `git log`?

Tags:

git

word-diff

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?

like image 937
dan Avatar asked Feb 06 '11 04:02

dan


People also ask

How do I see diff in git log?

Regular git log -p -- A will show all commits that touch file A, and for those commits, it'll show the diffs to A. With --full-diff , it'll show the same commits, but for each commit it'll show the diff of all files changed in that commit. In this case, commit C's diff will show diffs for files A and B.

How do I get git diff?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.

How does git diff work internally?

Diffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.

What does the command git log Oneline graph do?

git log by default shows the entire ancestry in order by birthdate (where timestamp weirdities don't make that contradict ancestry). Try it with git log --oneline --graph --decorate --first-parent . ^ or ^1 means the first parent.


2 Answers

What about --color-words? Additionally you somehow have to activate the diff.

git log --color-words -p

shows me kind of a colored diff.

like image 80
Paŭlo Ebermann Avatar answered Sep 30 '22 05:09

Paŭlo Ebermann


OK I think I got it working with

git log -m -p --word-diff=plain
like image 28
dan Avatar answered Sep 30 '22 03:09

dan