Prohibited Git branch names

Git doesn’t have any general letter-specific restrictions on branch names. Organizations can implement push restrictions with services like GitHub to restrict branch names–for example bad words or regex patterns.

The Windows operating system has general filename restrictions that restrict several keywords from Git branch names. The specific list of case-insensitive restricted keywords for filenames on Windows and hence Git branches includes:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9

For example on Windows:

> git switch -c con

fatal: cannot lock ref 'refs/heads/con': Unable to create '.git/refs/heads/con.lock': Invalid argument

Note that one can work with those branch names using Windows Subsystem for Linux (WSL), but even if you create such a branch, it will not work from native Windows:

warning: ignoring broken ref refs/heads/con