github/gitignore · Global/Windows.gitignore
Windows .gitignore Template Explained
Why Windows.gitignore ignores Thumbs.db, desktop.ini, $RECYCLE.BIN, installer packages and shortcut files, with notes on case sensitivity and global settings.
Windows.gitignore blocks the files Windows Explorer and the shell create in folders, plus installer package formats. At about 13 lines it is short and, like the macOS template, well suited to a personal global gitignore.
The Windows file system is case-insensitive, but git compares patterns case-sensitively by default. That is why some rules list both spellings, as in [Dd]esktop.ini.
Rules explained
| Pattern | What it ignores and why |
|---|---|
Thumbs.dbThumbs.db:encryptableehthumbs.dbehthumbs_vista.db | Thumbnail cachesThumbnail caches Explorer used to create in image folders. Since Vista a central cache is used, but they still appear on network drives or with old settings. |
[Dd]esktop.ini | Folder settingsA hidden system file that holds customizations such as the folder icon and display name. |
$RECYCLE.BIN/ | Recycle BinThe Recycle Bin folder created at the root of removable drives or volumes. It is caught when a repository is created at the root of a drive. |
*.cab*.msi*.msix*.msm*.msp | Installer packagesWindows Installer packages, merge modules, patches and cabinet archives. Treat them as build output or distribution files. |
*.lnk*.stackdump | Shortcuts and dumpsPersonal shortcut files and dumps left when Cygwin or MSYS programs terminate abnormally. |
Practical notes
core.ignorecaseis usually set totruewhen a repository is created on Windows or macOS. In that case matching ignores case, but on Linux CI case matters, so the bracket notation is safer. You can compare results by toggling the core.ignorecase option in the pattern tester.- If installers really must be in the repository (for example, a driver distribution repository), remove the
*.msiline or add an exception with!installers/*.msi. - Visual Studio-related files are handled by the VisualStudio template.
Original template
Windows.gitignore
# Windows thumbnail cache filesThumbs.dbThumbs.db:encryptableehthumbs.dbehthumbs_vista.db# Dump file*.stackdump# Folder config file[Dd]esktop.ini# Recycle Bin used on file shares$RECYCLE.BIN/# Windows Installer files*.cab*.msi*.msix*.msm*.msp# Windows shortcuts*.lnk
Templates from github/gitignore/Global/Windows.gitignore @356fd7b (2026-09-11) · CC0-1.0