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.
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)
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.
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.
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.
git diff --color-words --no-index old.txt new.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With