YorozuyaIT
Japanese Text & Encoding

Git Shows Übung.txt as Deleted and Untracked on macOS: Fixing Umlaut Filenames with core.precomposeunicode

Written by the Yorozuya IT editorial team, based in Japan. Menus, apps, and rules change, so check the date.

Short answer

You clone a project that was created on Linux, then run git status on your Mac. A file with an umlaut in its name appears twice: deleted in one list, untracked in another. Nothing changed. Your file system and Git disagree about how to spell the same name.

Same letter, two spellings

Ü can be stored as one character (U+00DC, NFC, composed) or as U plus a combining diaeresis (U+0308, NFD, decomposed). On screen they look the same. As bytes they differ. macOS file systems have a history of using the decomposed form for names, while Linux and Windows normally keep whatever you type, usually composed. (More on this in NFC, NFD, and Japanese text.)

Diagram: Git index has the composed name, macOS returns the decomposed name, Git sees two different names; the fix is core.precomposeunicode

The fix

Tell Git to convert names that come from macOS back to composed form before comparing:

git config --global core.precomposeunicode true

If it only happens in one repository, drop --global and run it inside that repository. Then run git status again.

Make non-ASCII names readable

By default Git prints non-ASCII names in quoted octal escapes, which is how you recognize the decomposed form: "U\314\210bung.txt". The bytes \314\210 are the combining diaeresis. To print names normally:

git config --global core.quotepath false

Find names stored in decomposed form

If your repository already contains decomposed names, find them:

git ls-files -z | python3 -c "
import sys, unicodedata
for name in sys.stdin.read().split('\0'):
    if name and name != unicodedata.normalize('NFC', name):
        print(name)
"

For each result, rename it to the composed form on a system that preserves what you type, then commit the change. Tell your team, because the rename shows up as a change for everyone.

Prevent it

Quick checklist

FAQ

Does this only affect German umlauts?

No. It affects any character that has a decomposed form: accents in French, Spanish, Czech, and Polish, and Japanese voiced kana such as が.

Is the default setting wrong on my Mac?

Recent Git versions on macOS normally set core.precomposeunicode when you create or clone a repository, but older repositories, unusual setups, or a global setting of false can leave it off.

Will the fix rename my files?

The setting changes how Git reads names from macOS. If the repository already contains decomposed names, find them with the script below and rename them to composed form.

Keep reading