This should work generally, but I use this to track the number of words changed in a (LaTeX) paper with a version history in git (and which Overleaf uses by default).
This is a tricky thing to deal with for many reasons.
Show the added words, deleted words, words on duplicate lines on every commit in the last day (bash):