Sometimes a diff makes it look like half a file was rewritten when you only moved or added a function. The diff algorithm is a setting, and a different one can change how the hunks line up.
The default is myers. Git also accepts minimal, patience and histogram. The docs describe histogram as an extension of patience that supports low-occurrence common elements, so it anchors on lines that are rare in the file instead of lines like a closing brace. Try it for one command first:
git diff --diff-algorithm=histogram
Git rejects a name it does not know, so a typo is easy to spot:
error: option diff-algorithm accepts "myers", "minimal", "patience" and "histogram"
If you like the result, make it the default:
git config --global diff.algorithm histogram
The setting also applies to git log -p and git show. It changes how a diff is displayed, not what your commits contain, so nothing needs undoing.
Caveat: on a simple change, such as one function added to a short file, the algorithms usually print identical output, so do not expect a difference every time. It shows up in files with many repeated lines. Also, two people with different settings see slightly different diffs of the same change, which matters when you compare notes about a patch.
Further reading: git-config: diff.algorithm