New files are invisible to git diff until you stage them. That annoys me when I want to review everything before a commit. git add -N fixes it without staging the content.
git add -N src/export.py
git diff
-N is short for --intent-to-add. Git records that the file will be added, but with no content yet. From then on git diff shows the whole file as new lines, git diff --stat counts it, and git status -s lists it with an A in the second column.
The nicest part is that git add -p now offers the new file too, so you can stage only some of its lines. Without -N, a new file is all or nothing.
To mark every untracked file at once, run git add -N ., but check git status first so you don’t pick up junk that should be in .gitignore.
Remember that the content still isn’t staged. If you run git commit right after git add -N, the file is not in the commit. You still have to git add it, or use git commit -a. And to undo the intent, git restore --staged on the file takes it back to untracked without touching what’s in it.
Further reading: git-add documentation