Skip to content

Instantly share code, notes, and snippets.

Last active April 13, 2024 12:52
Show Gist options
  • Save rock3r/ac33be8ae9df940e254ca4b4bb06fa9d to your computer and use it in GitHub Desktop.
Save rock3r/ac33be8ae9df940e254ca4b4bb06fa9d to your computer and use it in GitHub Desktop.
A template .gitignore for Kotlin projects using Gradle (with additional content for Android projects)
## Seb's .gitignore template
# You can find the most up-to-date version at
# Partly based on templates by
# Released under a CC-0 License
### Windows template
# Windows thumbnail cache files
# Dump file
# Folder config file
# Recycle Bin used on file shares
# Windows Installer files
# Windows shortcuts
### macOS template
# General
# Icon must end with two \r
# Thumbnails
# Files that might appear in the root of a volume
# Directories potentially created on remote AFP share
Network Trash Folder
Temporary Items
### Linux template
# temporary files which can be created if a process still has a handle open of a deleted file
# KDE directory preferences
# Linux trash folder which might appear on any partition or disk
# .nfs files are created when an open file is removed but is still being accessed
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference:
# Exclude non-user-specific stuff
### Kotlin template
# Compiled class file
# Log file
# Package Files #
# virtual machine crash logs, see
### Gradle template
# Note that you may need to exclude by hand other folders
# named build if necessary (e.g., in src/)
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
# Cache of project
### Android-specific stuff
# Built application files
# Files for the Dalvik VM
# Generated files
# Local configuration file (sdk path, etc)
# Google/Firebase secrets
Copy link

rock3r commented May 14, 2022


v1.4.1 (12 Feb 2023)

  • Clarify license: this is released under a CC0 license (Public Domain)

v1.4.0 (26 Sep 2022)

  • Improve build folder exclusion (thanks Eugen Martynov)

v1.3.1 (21 Aug 2022)

  • Add URL to this gist

v1.3 (24 May 2022)

v1.2 (16 May 2022)

v1.1 (14 May 2022)

  • Add exclusion for .idea/.name (IDE project display name)

v1.0 (13 May 2022)

  • Initial revision

Copy link

You might want to add .aab and .apks to your .gitignore-android for completeness sake.

Copy link

rock3r commented May 16, 2022

Great point, added! Thanks, @keyboardsurfer 🙌

Copy link

I think adding !.idea/file.template.settings.xml would be a nice addition to make sure you don't get just the templates themselves, but also their settings (how the file name should be, whether to reformat according to the style, and whether to enable live templates). It would be nice if the settings lived in the same directory as the templates, though.

Copy link

rock3r commented May 24, 2022

@tfcporciuncula good idea, have added that to the template. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment