Skip to content

Instantly share code, notes, and snippets.

@egarpor
Last active December 19, 2020 14:19
Show Gist options
  • Select an option

  • Save egarpor/1a707a3fdef592fe39887089ce0ba7c4 to your computer and use it in GitHub Desktop.

Select an option

Save egarpor/1a707a3fdef592fe39887089ce0ba7c4 to your computer and use it in GitHub Desktop.
View word-level coloured changes between two text files and export the comparison as an html file
# Create ansi2html.sh from https://www.pixelbeat.org/scripts/ansi2html.sh
# Give permisions with chmod 777 ansi2html.sh
# Do the magic: https://stackoverflow.com/questions/9706492/git-diff-output-to-file-preserve-coloring
git diff --word-diff --patience --color file_old file_new |./ansi2html.sh > changes.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment