Is there a git command to beautify the output of git diff between two branches?

Viewed 190

I'm using the command below to compare two branches and write the diff to a file.

git diff origin/master...origin/child > diff.log

The output of above will be in raw format. How can I have it in a beautified format and written to a file?

1 Answers

Color codes are disabled when writing to a file since most tools and text editors will choke on them. Use --color to force them to be written.

git diff --color origin/master...origin/child > diff.log

To view the file use less -R or cat.

less -R diff.log
cat diff.log
Related