For working with text that is prose, stored in plain text, I really like the output of git diff --color-words
, but I don't like the way it is dependent on ANSI terminal escape sequences. I'd like to get output that I can use to turn into HTML, some kind of user-friendly raw character display, or to generate statistics on the differences between the two files.
I prefer Perl (including CPAN), but would settle for pretty much anything.
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) Brown - MOVED (an existing file was moved to a new path) Red - REMOVED (an existing file was removed)
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.
The git diff command displays the differences between files in two commits or between a commit and your current repository. You can see what text has been added to, removed from, and changed in a file. By default, the git diff command displays any uncommitted changes to your repository.
The fourth line shows you symbol @@ and symbols ahead of it. They are called chunks. Chunks in git diff define the change' summary. In our image below the following chunk can be seen @@ -1,2 +1 @@ This means that lines one and two were changed in the first file and line one was changed in the second file.
This question asks about converting ANSI escape sequences into HTML color directives, and the accepted answer is a link to the Perl module HTML::FromANSI
, in CPAN.
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