Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use `git diff --color-words` outside a Git repository?

How can I get output like in git diff --color-words, but outside Git?

Closest thing is wdiff -t, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex.

like image 213
Vi. Avatar asked Apr 12 '11 14:04

Vi.


People also ask

What do the colors mean in git diff?

In the diff view there is a file tree showing all of the changes for that pull request. The colour of a particular file indicates the file change type: Green - ADDED (a new file was added) Blue - MODIFIED (an existing file was modified) Brown - COPIED (an existing file was copied to create a new file)

How does git diff change if you add the -- color words option to the command?

git diff --color-words git diff also has a special mode for highlighting changes with much better granularity: ‐‐color-words . This mode tokenizes added and removed lines by whitespace and then diffs those. Now the output displays only the color-coded words that have changed.

How does git diff work internally?

Diff command is used in git to track the difference between the changes made on a file. Since Git is a version control system, tracking changes are something very vital to it. Diff command takes two inputs and reflects the differences between them. It is not necessary that these inputs are files only.

Why is git diff not showing?

In answer to the original question, git diff isn't showing anything because you have a brand new directory, with a newly added file, but there are zero changes in the file for git diff to show. git status is showing that you added a new file, but git diff is for showing changes within files.


1 Answers

git diff --color-words --no-index old.txt new.txt 
like image 168
Vi. Avatar answered Sep 30 '22 18:09

Vi.