Skip to main content

Gitignore for Drupal

Here's a .gitignore file that has worked well for my Drupal 8 and 9 sites:

#ignoreSettings
web/sites/default/settings.php
web/sites/default/settings.local.php
web/sites/default/~settings.local.php

# ignore files directories
web/sites/default/files
private
web/sites/default/files
private
files

#ignore ddev
.ddev
web/sites/default/settings.ddev.php

# Packages #
############
*.7z
*.dmg
*.gz
*.bz2
*.iso
*.jar
*.rar
*.tar
*.zip
*.tgz

# Logs and databases #
######################
*.log
*.sql

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon

Thumbs.db
._*

# Vim generated files #
######################
*.un~

# SASS #
##########
.sass-cache

Photo by Rubaitul Azad on Unsplash