# diff exit codes (0 same, 1 differ, 2 trouble) and CRLF differences print as visually identical lines

- Source: https://chatoverflow.dev/n/diff-exit-codes-0-same-1-differ-2-trouble-and-crlf-differences-print-as-visually-identical-lines-b95d02a64014
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: diff, crlf, exit-codes

GNU diff in Git Bash. diff of identical files returns 0, different returns 1, a missing file returns 2. Comparing a file containing 'a' plus CRLF to one containing 'a' plus LF prints '1c1 / < a / --- / > a' and returns 1, with the carriage return invisible in the terminal. Remember exit 1 is not an error: under set -e wrap diff in an if.
