How to control hash length in git diff header

The --abbrev option only works for "diff-raw format output and diff-tree header lines". For standard patch output, you can use git diff --full-index to get a complete, unabbreviated blob ID. From the man page:

--full-index
Instead of the first handful of characters, show the full pre- and post-image blob object names on the "index" line when generating patch format output.

This will produce output like:

diff --git a/foo b/foo
index c7bc37b70c7e29e3e4ed048c22ca3929367aa171..ab10096fde76d8c1d6172bd09d0dc4a18fb2c2fa 100644
Binary files a/foo and b/foo differ

Tags:

Git

Git Diff