Sublime Text .gitignore template
The Sublime Text template ignores workspace state, package manager caches and the SFTP configuration file, which holds a plain text password for a remote server.
At a glance
- Category
- IDE
- Patterns in this template
- 18 rules
- Directories ignored
- 2 of the 18 rules end in a slash, so they match directories only
- Also needs an OS template
- Yes. This covers the editor and its packages only.
- Typical companions
- The language template for your project, plus an OS template.
In detail
The editor splits its state across two files and the distinction matters. A .sublime-project file holds the folders in the project, the build systems and the project scoped settings, which are all things a team might reasonably share. A .sublime-workspace file holds the session: open tabs, unsaved buffer contents, find history and cursor positions. This template ignores both, so if you want to share a project definition, remove that one line.
sftp-config.json is the rule that matters most. The popular upload package stores its configuration in that file, in the project root, and the configuration includes the host, the username and, by default, the password or the path to a private key. It is a plain text credential sitting in a file that looks like editor configuration, which is exactly the kind of thing that gets committed without a second glance.
sftp-config-alt*.json covers the alternative configurations of the same package. If either file has ever been committed, the credential is in the history of every clone and needs rotating, not just removing. That is the shape of every secret in git: an ignore rule stops the next commit and does nothing about the ones already made, so the fix always ends with changing the password.
The Package Control rules cover the package manager's caches and certificate bundles: the last run marker, the certificate authority lists, the merged and user bundles and the cache directory. Together they are the largest group in this template and the least interesting, since none of it is project specific.
The cache rules for *.tmlanguage.cache, *.tmPreferences.cache, *.stTheme.cache and bh_unicode_properties.cache cover compiled syntax definitions, preferences and theme data. GitHub.sublime-settings holds settings for an integration package, which can include an access token depending on how it was configured. None of the cache files are project specific, so they are pure noise in a diff and are rebuilt the first time the editor opens a file that needs them.
Examples
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
sftp-config.json
sftp-config-alt*.json
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
GitHub.sublime-settings18 lines exactly as the tool writes them, before any common additions you tick.
Things that catch people out
- sftp-config.json stores a password or key path in plain text. If it was ever committed, rotate the credential rather than only deleting the file.
- *.sublime-project is ignored alongside the workspace file, but a project definition is often worth sharing. Remove that one rule and keep the workspace rule.
- GitHub.sublime-settings can hold an access token depending on the integration package used, which is a better reason to keep the rule than editor tidiness.
Try it: .gitignore Generator
Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
.gitignore Generator
LOCAL · Browser-OnlyGenerate comprehensive .gitignore files by combining templates for languages, frameworks, IDEs, and operating systems
Language
Framework
IDE
OS
Build Tool
Infrastructure
Common Additions
Preview
Select templates or common additions to generate a .gitignore file.
Related .gitignore templates
All .gitignore templates →VS Code .gitignore template
This template ignores the .vscode folder's contents but keeps five files back on purpose, which is the clearest statement of the commit or ignore argument.
Vim .gitignore template
The Vim template uses character ranges to catch every swap file extension the editor cycles through, plus sessions, undo history and the netrw history.
macOS .gitignore template
Where .DS_Store actually comes from, why it appears in folders nobody edited, and what the rest of the macOS template covers on network and removable volumes.
Xcode .gitignore template
The Xcode template ignores the project bundle's contents while keeping the project file and shared data, the only way to share schemes but not sessions.
Android Studio .gitignore template
The Android Studio template ignores local.properties, which names the SDK path on one machine, along with build output, captures and native build directories.
Windows .gitignore template
What the Windows template covers: the thumbnail caches Explorer writes into image folders, the folder view settings file, and installer package extensions.
Tools for this
- .gitignore Generator Generate .gitignore files for any project - 50+ templates for languages, frameworks, IDEs, and OS